The snippet below will let you hide widgets from specific WordPress post and/or page.
1 2 3 4 5 6 7 8 | 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; } } } |
Snippet Source/Credit: WPSnipp