WP_Customize_Panel::__construct()publicWP 4.0.0

Constructor.

Any supplied $args override class property defaults.

Method of the class: WP_Customize_Panel{}

No Hooks.

Return

null. Nothing (null).

Usage

$WP_Customize_Panel = new WP_Customize_Panel();
$WP_Customize_Panel->__construct( $manager, $id, $args );
$manager(WP_Customize_Manager) (required)
Customizer bootstrap instance.
$id(string) (required)
A specific ID for the panel.
$args(array)

Array of properties for the new Panel object.

Default: empty array

  • priority(int)
    Priority of the panel, defining the display order of panels and sections.
    Default: 160

  • capability(string)
    Capability required for the panel.
    Default: edit_theme_options

  • theme_supports(mixed[])
    Theme features required to support the panel.

  • title(string)
    Title of the panel to show in UI.

  • description(string)
    Description to show in the UI.

  • type(string)
    Type of the panel.

  • active_callback(callable)
    Active callback.

Changelog

Since 4.0.0 Introduced.

WP_Customize_Panel::__construct() code WP 6.5.2

public function __construct( $manager, $id, $args = array() ) {
	$keys = array_keys( get_object_vars( $this ) );
	foreach ( $keys as $key ) {
		if ( isset( $args[ $key ] ) ) {
			$this->$key = $args[ $key ];
		}
	}

	$this->manager = $manager;
	$this->id      = $id;
	if ( empty( $this->active_callback ) ) {
		$this->active_callback = array( $this, 'active_callback' );
	}
	self::$instance_count += 1;
	$this->instance_number = self::$instance_count;

	$this->sections = array(); // Users cannot customize the $sections array.
}