函数原型
register_widget( string|WP_Widget $widget )
函数描述
Register a widget
是否弃用
未弃用
函数参数
-
$widget
string|WP_Widget
Required - Either the name of a
WP_Widgetsubclass or an instance of aWP_Widgetsubclass.
函数返回值
无
函数位置
File: wp-includes/widgets.php.
函数源码
function register_widget( $widget ) {
global $wp_widget_factory;
$wp_widget_factory->register( $widget );
}
源码链接
变更日志
| 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. |

