unregister_widget()注销删除一个小工具/侧边栏

目录

描述

Un-registers a widget.

unregister_widget() 描述

用法

<?php unregister_widget$widget_class ?>

unregister_widget() 用法

参数

$widget_class

(object) The name of a class that extends WP_Widget

/* ----------------------------------
 * wordpress之魂 © http://wphun.com
 * ---------------------------------- */

WP_Widget_Pages                   = Pages Widget
WP_Widget_Calendar                = Calendar Widget
WP_Widget_Archives                = Archives Widget
WP_Widget_Links                   = Links 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

unregister_widget() 参数

返回值

None.

unregister_widget() 返回值

源文件

unregister_widget() 函数的代码位于 wp-includes/widgets.php.

/* ----------------------------------
 * wordpress之魂 © http://wphun.com
 * ---------------------------------- */
/**
 * Unregister a widget
 *
 * Unregisters a WP_Widget widget. Useful for unregistering default widgets.
 * Run within a function hooked to the widgets_init action.
 *
 * @since 2.8.0
 *
 * @see WP_Widget
 *
 * @global WP_Widget_Factory $wp_widget_factory
 *
 * @param string $widget_class The name of a class that extends WP_Widget
 */
function unregister_widget($widget_class) {
	global $wp_widget_factory;

	$wp_widget_factory->unregister($widget_class);
}

unregister_widget() 源文件

相关