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().
Contents
Description
Subclasses can override this with their specific logic, or they may provide an ‘active_callback’ argument to the constructor.
Return
(bool) Always true.
Source
File: wp-includes/class-wp-customize-panel.php
public function active_callback() { return true; }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
4.1.0 | Introduced. |