Does someone know a solution for this?
I want to remove (not unregister) all widgets from a sidebar with a function.
Does someone know a solution for this?
I want to remove (not unregister) all widgets from a sidebar with a function.
You could add this function to your functions.php file.
add_filter( 'sidebars_widgets', 'disable_all_widgets' );
function disable_all_widgets( $sidebars_widgets ) {
$sidebars_widgets = array( false );
return $sidebars_widgets;
}
You could also use the WordPress conditional tags to disable widgets only on certain pages. For example; this would only disable widgets on the home page.
add_filter( 'sidebars_widgets', 'disable_all_widgets' );
function disable_all_widgets( $sidebars_widgets ) {
if ( is_home() )
$sidebars_widgets = array( false );
return $sidebars_widgets;
}