Remove widget from sidebar.
Parameters
$id
int|stringrequired- Widget ID.
Source
function wp_unregister_sidebar_widget( $id ) {
/**
* Fires just before a widget is removed from a sidebar.
*
* @since 3.0.0
*
* @param int|string $id The widget ID.
*/
do_action( 'wp_unregister_sidebar_widget', $id );
wp_register_sidebar_widget( $id, '', '' );
wp_unregister_widget_control( $id );
}
Hooks
- do_action( ‘wp_unregister_sidebar_widget’,
int|string $id ) Fires just before a widget is removed from a sidebar.
Changelog
Version | Description |
---|---|
2.2.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.