WP_Customize_Control
- Since
- 3.4.0
- Source
wp-includes/class-wp-customize-control.php:20
Customize Control class.
Compatibility
- WordPress
- since 3.4.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Hooks and filters fired · 3
Every hook that fires from inside WP_Customize_Control, in the order it appears in the class, grouped by the method that fires it.
Properties · 17
$instance_countintprotected static- Incremented with each new class instantiation, then stored in $instance_number.
$instance_numberintpublic- Order in which this instance was created in relation to other instances.
$managerWP_Customize_Managerpublic- Customizer manager.
$idstringpublic- Control ID.
$settingsarraypublic- All settings tied to the control.
$settingstring|WP_Customize_Setting|nullpublic- The primary setting for the control (if there is one).
$capabilitystringpublic- Capability required to use this control.
$priorityintpublic- Order priority to load the control in Customizer.
$sectionstringpublic- Section the control belongs to.
$labelstringpublic- Label for the control.
$descriptionstringpublic- Description for the control.
$choicesarraypublic- List of choices for 'radio' or 'select' type controls, where values are the keys, and labels are the values.
$input_attrsarraypublic- List of custom input attributes for control output, where attribute names are the keys and values are the values.
$allow_additionboolpublic- Show UI for adding new content, currently only used for the dropdown-pages control.
$jsonarraypublic$typestringpublic- Control's Type.
$active_callbackcallablepublic- Callback.
Methods · 17
- __construct()Constructor.
- enqueue()Enqueues control related scripts/styles.
- active()Checks whether control is active to current Customizer preview.
- active_callback()Default callback used when invoking WP_Customize_Control::active().
- value()Fetches a setting's value.
- to_json()Refreshes the parameters passed to the JavaScript via JSON.
- json()Gets the data to export to the client via JSON.
- check_capabilities()Checks if the user can use this control.
- get_content()Gets the control's content for insertion into the Customizer pane.
- maybe_render()Checks capabilities and render the control.
- render()Renders the control wrapper and calls $this->render_content() for the internals.
- get_link()Gets the data link attribute for a setting.
- link()Renders the data link attribute for the control's input element.
- input_attrs()Renders the custom attributes for the control's input element.
- render_content()Renders the control's content.
- print_template()Renders the control's JS template.
- content_template()An Underscore (JS) template for this control's content (but not its container).
Source code
#[AllowDynamicProperties]class WP_Customize_Control { /** * Incremented with each new class instantiation, then stored in $instance_number. * * Used when sorting two instances whose priorities are equal. * * @since 4.1.0 * @var int */ protected static $instance_count = 0; /** * Order in which this instance was created in relation to other instances. * * @since 4.1.0 * @var int */ public $instance_number; /** * Customizer manager. * * @since 3.4.0 * @var WP_Customize_Manager */ public $manager; /** * Control ID. * * @since 3.4.0 * @var string */ public $id; /** * All settings tied to the control. * * @since 3.4.0 * @var array */ public $settings; /** * The primary setting for the control (if there is one). * * @since 3.4.0 * @var string|WP_Customize_Setting|null */ public $setting = 'default'; /** * Capability required to use this control. * * Normally this is empty and the capability is derived from the capabilities * of the associated `$settings`. * * @since 4.5.0 * @var string */ public $capability; /** * Order priority to load the control in Customizer. * * @since 3.4.0 * @var int */ public $priority = 10; /** * Section the control belongs to. * * @since 3.4.0 * @var string */ public $section = '';Changelog
Introduced in 3.4.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 6.8.8 tag, from
src/wp-includes/class-wp-customize-control.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.