I will show you how to make WordPress custom widgets like your choice. To do this you need to follow some steps. Let’s start without exaggerating. You must know the widget ID number. To know the widget ID, you need to find out the web source and some inspector tools. This sample has a pages widget and contact form. You put it in the code as you need.

The code in bellow:

add_filter( 'widget_display_callback', 'hide_widget_pages', 10, 3 );
function hide_widget_pages( $instance, $widget, $args ) {
if ( $widget->id_base == 'pages' ) { // change 'pages' to widget name
if ( !is_page( 'contact' ) ) { // change page name
return false;

Leave a Reply

Your email address will not be published. Required fields are marked *