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.
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 ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
4.0.0 | Introduced. |