unregister_widget( string|WP_Widget $widget )
Unregisters a widget.
Description
Unregisters a WP_Widget widget. Useful for un-registering default widgets. Run within a function hooked to the ‘widgets_init’ action.
See also
Parameters
- $widget
-
(Required) Either the name of a
WP_Widget
subclass or an instance of aWP_Widget
subclass.
Source
File: wp-includes/widgets.php
function unregister_widget( $widget ) {
global $wp_widget_factory;
$wp_widget_factory->unregister( $widget );
}
Changelog
Version | Description |
---|---|
WP-4.6.0 | Updated the $widget parameter to also accept a WP_Widget instance object instead of simply a WP_Widget subclass name. |
WP-2.8.0 | Introduced. |