Home / functions.php / Disable widget areas on specific pages of your blog
  • Disable widget areas on specific pages of your blog

    disable-widget-areas-on-specific-pages-of-your-blog

    Adding this snippet to the functions.php of your wordpress theme will disable widgets on the specified page.

    wordpress snippet : PHP

    <>
    <?php
    add_filter( 'sidebars_widgets', 'disable_sidebar_widgets' );
    function disable_sidebar_widgets( $sidebars_widgets ) {
    	if ( is_page('about-me') )
    		$sidebars_widgets = array( false );
    	        return $sidebars_widgets;
    }
    ?>
    

    ( WordPress codex functions, hooks, in this snippet. )

    sidebars_widgets, is_page, add_filter,

Build a better with wpsnipp.com

Weekly snippets, themes, deals coupons roundup.

x No Thanks