Widget Controls

Controls for managing widgets in the Customizer.


WP_Widget_Area_Customize_Control

Control representing a widget area (sidebar) with add/reorder widget functionality.

Source: wp-includes/customize/class-wp-widget-area-customize-control.php
Since: 3.9.0
Extends: WP_Customize_Control

Properties

PropertyTypeVisibilityDefaultSinceDescription
$typestringpublic'sidebar_widgets'3.9.0Control type
$sidebar_idint|stringpublic3.9.0Sidebar ID

Methods

MethodVisibilitySinceDescription
to_json()public3.9.0Exports parent JSON plus sidebar_id.
render_content()public3.9.0Renders "Add a Widget" button (controls #available-widgets), "Reorder"/"Done" toggle button, and screen reader description text.

WP_Widget_Form_Customize_Control

Control for an individual widget form, with deferred rendering via JSON export.

Source: wp-includes/customize/class-wp-widget-form-customize-control.php
Since: 3.9.0
Extends: WP_Customize_Control

Properties

PropertyTypeVisibilityDefaultSinceDescription
$typestringpublic'widget_form'3.9.0Control type
$widget_idstringpublic3.9.0Widget ID
$widget_id_basestringpublic3.9.0Widget ID base
$sidebar_idstringpublic3.9.0Sidebar ID
$is_newboolpublicfalse3.9.0Whether this is a new widget
$widthintpublic3.9.0Widget width
$heightintpublic3.9.0Widget height
$is_wideboolpublicfalse3.9.0Whether widget is wide

Methods

MethodVisibilitySinceDescription
to_json()public3.9.0Exports parent JSON plus widget_id, widget_id_base, sidebar_id, width, height, is_wide. Also generates widget_control and widget_content HTML via wp_list_widget_controls_dynamic_sidebar() and $this->manager->widgets->get_widget_control_parts(). Requires wp-admin/includes/widgets.php.
render_content()public3.9.0No-op; content exported via to_json() for deferred embedding.
active_callback()public4.0.0Returns true if the widget is rendered on the page, via $this->manager->widgets->is_widget_rendered( $this->widget_id ).

Control for the widgets block editor in the Customizer. Renders an empty container; the block editor is initialized by @wordpress/customize-widgets JavaScript.

Source: wp-includes/customize/class-wp-sidebar-block-editor-control.php
Since: 5.8.0
Extends: WP_Customize_Control

Properties

PropertyTypeVisibilityDefaultSinceDescription
$typestringpublic'sidebar_block_editor'5.8.0Control type

Methods

MethodVisibilitySinceDescription
render_content()public5.8.0Renders empty content. JavaScript in @wordpress/customize-widgets handles the rest.