Categories
Blog Code Snippets PHP Wordpress

WordPress – Deactivate a Sidebar or Widgetized Area

Here’s how to deactive a Sidebar or Widgetized Area in WordPress so it won’t show on the website and neither will it show on the Widgets section of the wordpress backend.

First, get the name of the sidebar, you may need to check the theme functions file to get exactly it is.

In this case, we will assume that the sidebar name is ‘sidebar-1’.

Add the code below to your functions file.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function remove_some_widgets(){
// Unregister sidebar
unregister_sidebar( 'sidebar-1' );
}
add_action( 'widgets_init', 'remove_some_widgets', 11 );
function remove_some_widgets(){ // Unregister sidebar unregister_sidebar( 'sidebar-1' ); } add_action( 'widgets_init', 'remove_some_widgets', 11 );
function remove_some_widgets(){

	// Unregister sidebar
	unregister_sidebar( 'sidebar-1' );

}
add_action( 'widgets_init', 'remove_some_widgets', 11 );

Leave a Reply