The default WordPress widget system shows every widget in a sidebar on every page where that sidebar appears. Display Widgets and similar plugins add visibility rules, but there are also code-based approaches worth knowing.
Using Display Widgets
After installing Display Widgets, go to Appearance, then Widgets. Expand any widget. At the bottom of the widget settings, you will find the Display Widgets panel with a list of page types. Select whether to show or hide the widget on specific contexts:
- Front Page
- Single Post
- Pages
- Archives (category, tag, date, author)
- Search Results
- 404 Page
By default, the widget shows everywhere. Select specific page types to restrict it, or use an exclude mode if the plugin supports it. Save the widget after changing visibility settings.
Using Widget Options (Recommended Alternative)
Widget Options is a more actively maintained alternative with a cleaner security history. It offers the same visibility controls plus device type visibility (mobile vs desktop). Installation and use is the same as Display Widgets — visibility settings appear in each widget’s control panel.
Using Jetpack Widget Visibility
If you already have Jetpack installed, it includes a widget visibility module. Enable it under Jetpack, then Settings, then Writing. Once enabled, each widget gets a Visibility button that opens a rule builder where you can specify show/hide conditions using a visual interface.
Code Approach: Custom Widget Wrapper
For precise control without a plugin, wrap widget content with conditional tags in your theme’s sidebar template. In sidebar.php:
<?php if ( is_single() ) : ?>
<?php dynamic_sidebar( 'blog-sidebar' ); ?>
<?php elseif ( is_page() ) : ?>
<?php dynamic_sidebar( 'page-sidebar' ); ?>
<?php else : ?>
<?php dynamic_sidebar( 'default-sidebar' ); ?>
<?php endif; ?>
This approach uses separate sidebar registrations for different page types, each with their own widget assignments. Cleaner than per-widget visibility rules, but requires registering multiple sidebars in functions.php.
Showing Different Sidebars on Different Post Types
Register separate sidebars in functions.php:
register_sidebar( array(
'name' => 'Blog Sidebar',
'id' => 'sidebar-blog',
) );
register_sidebar( array(
'name' => 'Shop Sidebar',
'id' => 'sidebar-shop',
) );
Then conditionally load the correct sidebar in your template:
if ( is_woocommerce() || is_shop() || is_product() ) {
dynamic_sidebar( 'sidebar-shop' );
} else {
dynamic_sidebar( 'sidebar-blog' );
}
Block-Based Widgets and FSE
If you are using a block theme or the block-based widget editor, Display Widgets may not be compatible. For block themes, use the Block Visibility plugin which adds show/hide conditions to individual blocks, replacing the need for a widget visibility plugin entirely.
For custom sidebar configurations, complex widget conditional logic, or sidebar redesigns, a WordPress developer can implement the right approach for your theme and content structure.