unregister_widget( string|WP_Widget $widget )
Unregisters a widget.
Description Description
Unregisters a WP_Widget widget. Useful for un-registering default widgets. Run within a function hooked to the ‘widgets_init’ action.
See also See also
Parameters Parameters
- $widget
-
(string|WP_Widget) (Required) Either the name of a
WP_Widget
subclass or an instance of aWP_Widget
subclass.
Source Source
File: wp-includes/widgets.php
function unregister_widget( $widget ) { global $wp_widget_factory; $wp_widget_factory->unregister( $widget ); }
Expand full source code Collapse full source code View on Trac
Changelog Changelog
Version | Description |
---|---|
4.6.0 | Updated the $widget parameter to also accept a WP_Widget instance object instead of simply a WP_Widget subclass name. |
2.8.0 | Introduced. |
User Contributed Notes User Contributed Notes
You must log in before being able to contribute a note or feedback.
Example
This will un-register the built-in WP_Widget_Calendar widget (useful if you wish to replace the built-in version).
Available parameters (from the Codex):