WP_Widget_Factory::register() public WP 2.8.0
Registers a widget subclass.
{} Это метод класса: WP_Widget_Factory{}
Хуков нет.
Возвращает
null
. Ничего.
Использование
$WP_Widget_Factory = new WP_Widget_Factory(); $WP_Widget_Factory->register( $widget );
- $widget(строка/WP_Widget) (обязательный)
- Either the name of a WP_Widget subclass or an instance of a WP_Widget subclass.
Список изменений
С версии 2.8.0 | Введена. |
С версии 4.6.0 | Updated the $widget parameter to also accept a WP_Widget instance object instead of simply a WP_Widget subclass name. |
Код WP_Widget_Factory::register() WP Widget Factory::register WP 5.7.1
public function register( $widget ) {
if ( $widget instanceof WP_Widget ) {
$this->widgets[ spl_object_hash( $widget ) ] = $widget;
} else {
$this->widgets[ $widget ] = new $widget();
}
}