Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/unregister sidebar


De-registers a previously registered sidebar.


 <?php unregister_sidebar$id ); ?> 


(string) (required) The ID of the sidebar when it was added.
Default: None


If added to a child theme's functions.php file, this will remove the footer sidebars registered by the TwentyTen theme.

function remove_some_widgets(){

	// Unregister some of the TwentyTen sidebars
	unregister_sidebar( 'first-footer-widget-area' );
	unregister_sidebar( 'second-footer-widget-area' );
	unregister_sidebar( 'third-footer-widget-area' );
	unregister_sidebar( 'fourth-footer-widget-area' );
add_action( 'widgets_init', 'remove_some_widgets', 11 );


In the example, note that we assign a priority of 11 when registering the widgets_init hook. This is because a child theme's functions.php file is called before the parent theme's, which means that our call to unregister_sidebar() would accomplish nothing since the sidebar has not yet been registered.

By lowering the priority of our action, we ensure that it is called after the parent theme's functions.php file is loaded.

Change Log

Since: 2.2.0

Source File

unregister_sidebar() is located in wp-includes/widgets.php.


Sidebars: is_active_sidebar(), is_dynamic_sidebar(), dynamic_sidebar(), register_sidebars(), register_sidebar(), unregister_sidebar(), wp_register_sidebar_widget(), wp_unregister_sidebar_widget(), wp_get_sidebars_widgets(), wp_set_sidebars_widgets()

See also index of Function Reference and index of Template Tags.