WP_Widget_Form_Customize_Control::active_callback() WordPress Method

The active_callback() method is used to determine whether a widget is active or not. This is useful for widgets that are only meant to be displayed on certain pages or posts. For example, a widget that displays a contact form might only be active on the contact page. The active_callback() method takes two parameters: the $instance and $current_instance. The $instance parameter is an array of all the widget's settings. The $current_instance parameter is an array of the current widget's settings. The active_callback() method returns a boolean value. If the widget is active, the method returns true. If the widget is not active, the method returns false.

WP_Widget_Form_Customize_Control::active_callback() #

Whether the current widget is rendered on the page.


Return

(bool) Whether the widget is rendered.


Top ↑

Source

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

	public function active_callback() {
		return $this->manager->widgets->is_widget_rendered( $this->widget_id );
	}

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.