WP_Widget::_register_one() WordPress Method

The WP_Widget::_register_one() method is used to register a single widget with WordPress. This method is called by the WP_Widget::register() method, which is used to register multiple widgets.

WP_Widget::_register_one( int $number = -1 ) #

Registers an instance of the widget class.


Parameters

$number

(int)(Optional) The unique order number of this widget instance compared to other instances of the same class.

Default value: -1


Top ↑

Source

File: wp-includes/class-wp-widget.php

	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 )
		);
	}


Top ↑

Changelog

Changelog
VersionDescription
2.8.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.