unregister_sidebar( string|int $sidebar_id )
Removes a sidebar from the list.
Description Description
Parameters Parameters
- $sidebar_id
-
(string|int) (Required) The ID of the sidebar when it was registered.
Source Source
File: wp-includes/widgets.php
function unregister_sidebar( $sidebar_id ) { global $wp_registered_sidebars; unset( $wp_registered_sidebars[ $sidebar_id ] ); }
Expand full source code Collapse full source code View on Trac
Changelog Changelog
Version | Description |
---|---|
2.2.0 | Introduced. |
User Contributed Notes User Contributed Notes
You must log in before being able to contribute a note or feedback.
Basic Example
If added to a child theme’s functions.php file, this will remove the footer sidebars registered by the TwentyTen theme.
Notes
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.