WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/unregister widget

Description

Un-registers a widget.

Usage

<?php unregister_widget$widget_class ?>

Parameters

$widget_class
(object) The name of a class that extends WP_Widget
WP_Widget_Pages                   = Pages Widget
WP_Widget_Calendar                = Calendar Widget
WP_Widget_Archives                = Archives Widget
WP_Widget_Links                   = Links Widget
WP_Widget_Media_Audio             = Audio Player Media Widget 
WP_Widget_Media_Image             = Image Media Widget 
WP_Widget_Media_Video             = Video Media Widget 
WP_Widget_Media_Gallery           = Gallery Media Widget 
WP_Widget_Meta                    = Meta Widget
WP_Widget_Search                  = Search Widget
WP_Widget_Text                    = Text Widget
WP_Widget_Categories              = Categories Widget
WP_Widget_Recent_Posts            = Recent Posts Widget
WP_Widget_Recent_Comments         = Recent Comments Widget
WP_Widget_RSS                     = RSS Widget
WP_Widget_Tag_Cloud               = Tag Cloud Widget
WP_Nav_Menu_Widget                = Menus Widget
WP_Widget_Custom_HTML             = Custom HTML Widget

Return Values

None.

Example

This will unregister the built-in WP_Widget_Calendar widget (useful if you wish to replace the built-in version).

function remove_calendar_widget() {
	unregister_widget('WP_Widget_Calendar');
}

add_action( 'widgets_init', 'remove_calendar_widget' );

Source File

unregister_widget() is located in wp-includes/widgets.php.

Related

Widgets: is_active_widget(), the_widget(), register_widget(), unregister_widget(), wp_register_widget_control(), wp_unregister_widget_control(), wp_convert_widget_settings(), wp_get_widget_defaults(), wp_widget_description()

See also index of Function Reference and index of Template Tags.