WP_Widget::_register_one()publicWP 2.8.0

Registers an instance of the widget class.

Метод класса: WP_Widget{}

Хуков нет.

Возвращает

null. Ничего.

Использование

$WP_Widget = new WP_Widget();
$WP_Widget->_register_one( $number );
$number(int)
The unique order number of this widget instance compared to other instances of the same class.
По умолчанию: -1

Список изменений

С версии 2.8.0 Введена.

Код WP_Widget::_register_one() WP 6.1.1

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