In WordPress ecosystem, Widgets are essentials.
- Widget Options Delivers Powerful Features in Lightweight Plugin.
- The Complete Guide to WordPress Widgets.
- Widget Options – World’s Best WordPress Widget Control Plugin.
We usually use average ~10 widgets at any given time. There are few in Sidebar and few in Post contents. By default WordPress doesn’t provide any simple utility by which you could disable specific widget on specific post/page, etc.
Option-1 – Manually
As often you need to disable Sidebar Widget on Specific Post/Page, below simple code snippet will help you to perform the same.
Just add below to functions.php file and you are all set.
add_filter( 'sidebars_widgets', 'crunchify_code_disable_widgets' ); function crunchify_code_disable_widgets( $sidebars_widgets ) { if (is_single(array(5,123,43,54))) // replace this with post/page ID $sidebars_widgets = array( false ); return $sidebars_widgets; }
Option-2 Using Plugin
Widget Options is a WordPress plugin which provides nice functionality using it you could hide or show widgets based on Category, Post or Page.
With Widget Options WordPress Plugin, you can easily assign pages visibility and restrict each widgets on different pages, posts, custom post types, categories, tags.
Let me know if you have any questions and I’m more than happy to provide an update quickly.
How to Disable Block-Based Widget Editor?
Genesis Framework by default disables block-based widget editor. If you don’t see that disabled then add below code to disable it.
add_filter( 'use_widgets_block_editor', '__return_false' );
To enable it back forcefully then use below code.
add_filter( 'use_widgets_block_editor', '__return_true' );
Let me know if you face any issue setting this up.