On this page
WP_Widget_Factory::register( string|WP_Widget $widget )
Registers a widget subclass.
Parameters
$widgetstring|WP_Widget Required-
Either the name of a
WP_Widgetsubclass or an instance of aWP_Widgetsubclass.
Source
File: wp-includes/class-wp-widget-factory.php. View all references
public function register( $widget ) {
if ( $widget instanceof WP_Widget ) {
$this->widgets[ spl_object_hash( $widget ) ] = $widget;
} else {
$this->widgets[ $widget ] = new $widget();
}
}
Related
Used By
| Used By | Description |
|---|---|
| register_widget() wp-includes/widgets.php | Register a widget |
Changelog
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_widget_factory/register