unregister_sidebar()WP 2.2.0

Removes a sidebar from the list.

No Hooks.


null. Nothing (null).


unregister_sidebar( $sidebar_id );
$sidebar_id(string|int) (required)
The ID of the sidebar when it was registered.



#1 Cancel registered sidebars

If you add this code to functions.php, the sidebars registered for the TwentyTen theme will be cancelled:

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

function remove_some_widgets(){

	// Unregister some widget panels
	unregister_sidebar( 'first-footer-widget-area' );
	unregister_sidebar( 'second-footer-widget-area' );
	unregister_sidebar( 'third-footer-widget-area' );
	unregister_sidebar( 'fourth-footer-widget-area' );

In the example, we set priority 11 to the widgets_init hook because the child theme's functions.php connects before the main one. This means that if you leave the field empty, the priority will be 10 and the widgets will not be cancelled.

By changing the priority of our hook, we can make sure that it will be called after the functions.php file of the parent theme is loaded.


  • Global. Array. $wp_registered_sidebars The registered sidebars.


Since 2.2.0 Introduced.

unregister_sidebar() code WP 6.5.3

function unregister_sidebar( $sidebar_id ) {
	global $wp_registered_sidebars;

	unset( $wp_registered_sidebars[ $sidebar_id ] );