customize_loaded_components

Filters the core Customizer components to load.

Description

apply_filters( 'customize_loaded_components', (array) $this_components, (WP_Customize_Manager) $instance ); 

This allows Core components to be excluded from being instantiated by filtering them out of the array. Note that this filter generally runs during the action, so it cannot be added in a theme.

Parameters (2)

0. $this_components (array)
List of core components to load.
1. $instance (WP_Customize_Manager)
WP_Customize_Manager instance.

Usage

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

Defined (1)

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

/wp-includes/class-wp-customize-manager.php  
  1. $components = apply_filters( 'customize_loaded_components', $this->components, $this );