On this page
WP_Widget::_register_one( int $number = -1 )
Registers an instance of the widget class.
Parameters
$numberint Optional-
The unique order number of this widget instance compared to other instances of the same class.
Default:
-1
Source
File: wp-includes/class-wp-widget.php. View all references
public function _register_one( $number = -1 ) {
wp_register_sidebar_widget(
$this->id,
$this->name,
$this->_get_display_callback(),
$this->widget_options,
array( 'number' => $number )
);
_register_widget_update_callback(
$this->id_base,
$this->_get_update_callback(),
$this->control_options,
array( 'number' => -1 )
);
_register_widget_form_callback(
$this->id,
$this->name,
$this->_get_form_callback(),
$this->control_options,
array( 'number' => $number )
);
}
Related
Uses
| Uses | Description |
|---|---|
| WP_Widget::_get_display_callback() wp-includes/class-wp-widget.php | Retrieves the widget display callback. |
| WP_Widget::_get_update_callback() wp-includes/class-wp-widget.php | Retrieves the widget update callback. |
| WP_Widget::_get_form_callback() wp-includes/class-wp-widget.php | Retrieves the form callback. |
| wp_register_sidebar_widget() wp-includes/widgets.php | Register an instance of a widget. |
| _register_widget_update_callback() wp-includes/widgets.php | Registers the update callback for a widget. |
| _register_widget_form_callback() wp-includes/widgets.php | Registers the form callback for a widget. |
Used By
| Used By | Description |
|---|---|
| WP_Widget_Text::_register_one() wp-includes/widgets/class-wp-widget-text.php | Add hooks for enqueueing assets when registering all widget instances of this widget class. |
| WP_Widget_Custom_HTML::_register_one() wp-includes/widgets/class-wp-widget-custom-html.php | Add hooks for enqueueing assets when registering all widget instances of this widget class. |
| WP_Widget_Media::_register_one() wp-includes/widgets/class-wp-widget-media.php | Add hooks while registering all widget instances of this widget class. |
| WP_Widget::_register() wp-includes/class-wp-widget.php | Register all widget instances of this widget class. |
Changelog
| Version | Description |
|---|---|
| 2.8.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_widget/_register_one