Disable widgets on specific pages

This is a function that will remove widget areas from our home page. Well, you might have other pages, posts, archives, or whatever in mind that you want to disable widget areas on. Adding this php code to your functions.php will disable widgets on the home page only, without completely disabling widgets. You could change is_home() to is_page() or specific pages.




add_filter( 'sidebars_widgets', 'disable_all_widgets' );
function disable_all_widgets( $sidebars_widgets ) {
if ( is_home() )
$sidebars_widgets = array( false );
return $sidebars_widgets;

Leave a comment