customize_panel_active

Filters response of WP_Customize_Panel::active().

Description

apply_filters( 'customize_panel_active', (bool) $active, (WP_Customize_Panel) $panel ); 

Parameters (2)

0. $active (bool)
Whether the Customizer panel is active.
1. $panel (WP_Customize_Panel)
WP_Customize_Panel instance.

Usage

To run the hook, copy the example below.
  1. $active = apply_filters( 'customize_panel_active', $active, $panel ); 
  2.  
  3. if ( !empty( $active ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the customize_panel_active callback 
  2. function filter_customize_panel_active( $active, $panel ) { 
  3. // make filter magic happen here... 
  4. return $active
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'customize_panel_active', 'filter_customize_panel_active', 10, 2 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'customize_panel_active', 'filter_customize_panel_active', 10, 2 ); 

Defined (1)

The filter is defined in the following location(s).

/wp-includes/class-wp-customize-panel.php  
  1. $active = apply_filters( 'customize_panel_active', $active, $panel );