WP_Customize_Control::active_callback() WordPress Method

The WP_Customize_Control::active_callback() method is used to determine whether a Customizer control is active. This method is called when the Customizer is first loaded, and whenever a setting is changed that could affect the control. The control is considered active if the active_callback() method returns true. The active_callback() method can be used to hide or show a control based on the value of another setting. For example, you could use the active_callback() method to show a control only when the 'show_on_front' setting is set to 'posts'. You can also use the active_callback() method to show or hide a control based on the capabilities of the current user. For example, you could use the active_callback() method to show a control only to users who have the 'manage_options' capability. The active_callback() method accepts two arguments: $control and $value. The $control argument is a WP_Customize_Control object. The $value argument is the value of the setting that the control is tied to. The active_callback() method should return a boolean value. If the method returns true, the control will be shown. If the method returns false, the control will be hidden.

WP_Customize_Control::active_callback() #

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


Description

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


Top ↑

Return

(true) Always true.


Top ↑

Source

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

	public function active_callback() {
		return true;
	}

Top ↑

Changelog

Changelog
VersionDescription
4.0.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.