WP_Customize_Panel::active_callback() WordPress Method

The WP_Customize_Panel::active_callback() method is used to determine whether a Customizer panel is active. This method is called by the Customizer when initializing the panels. It can be used to conditionally show or hide a panel based on certain criteria. The criteria for determining whether a panel is active can be anything that you like. For example, you could use this callback to only show a panel if the current user is an administrator. This callback can return a boolean value or a callable. If you return a boolean, the panel will be shown or hidden based on the value you return. If you return a callable, the callable will be invoked with the panel object as its only argument. The panel will be shown or hidden based on the return value of the callable.

WP_Customize_Panel::active_callback() #

Default callback used when invoking WP_Customize_Panel::active().


Description

Subclasses can override this with their specific logic, or they may provide an ‘active_callback’ argument to the constructor.


Top ↑

Return

(bool) Always true.


Top ↑

Source

File: wp-includes/class-wp-customize-panel.php

	public function active_callback() {
		return true;
	}

Top ↑

Changelog

Changelog
VersionDescription
4.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.