WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WP_Customize_Manager::add_control() WP 3.4.0

Add a customize control.

Это метод класса: WP_Customize_Manager

Хуков нет.


WP_Customize_Control. The instance of the control that was added.


$WP_Customize_Manager = new WP_Customize_Manager();
$var = $WP_Customize_Manager->add_control( $id, $args );
$id(WP_Customize_Control/строка) (обязательный)
Customize Control object, or ID.

Array of properties for the new Control object.

  • $settings (массив)
    All settings tied to the control. If undefined. IDs in the array correspond to the ID of a registered WP_Customize_Setting.
    По умолчанию: $setting

  • $setting (строка)
    The primary setting for the control (if there is one).
    По умолчанию: 'default'

  • $capability (строка)
    Capability required to use this control. Normally derived from $settings.

  • $priority (число)
    Order priority to load the control.
    По умолчанию: 10

  • $section (строка)
    The section this control belongs to.
    По умолчанию: ''

  • $label (строка)
    Label for the control.
    По умолчанию: ''

  • $description (строка)
    Description for the control.
    По умолчанию: ''

  • $choices (массив)
    List of choices for 'radio' or 'select' type controls, where values are the keys, and labels are the values.
    По умолчанию: empty array

  • $input_attrs (массив)
    List of custom input attributes for control output, where attribute names are the keys and values are the values.
    По умолчанию: empty array

  • $allow_addition (true/false)
    Show UI for adding new content, currently only used for the dropdown-pages control.
    По умолчанию: false

  • $type (строка)
    The type of the control.
    По умолчанию: 'text'

  • $active_callback (callback)
    Active callback.

По умолчанию: empty array

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

С версии 3.4.0 Введена.
С версии 4.5.0 Return added WP_Customize_Control instance.

Код WP Customize Manager::add control: wp-includes/class-wp-customize-manager.php WP 5.3.1

public function add_control( $id, $args = array() ) {
	if ( $id instanceof WP_Customize_Control ) {
		$control = $id;
	} else {
		$control = new WP_Customize_Control( $this, $id, $args );

	$this->controls[ $control->id ] = $control;
	return $control;