Filter hook 'customize_loaded_components'

in WP Core File wp-includes/class-wp-customize-manager.php at line 359

View Source

customize_loaded_components

Filter Hook
Description
Filters the core Customizer components to load. 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 {@see 'plugins_loaded'} action, so it cannot be added in a theme.

Hook Information

File Location wp-includes/class-wp-customize-manager.php View on GitHub
Hook Type Filter
Line Number 359

Hook Parameters

Type Name Description
string[] $components Array of core components to load.
WP_Customize_Manager $manager WP_Customize_Manager instance.

Usage Examples

Basic Usage
<?php
// Hook into customize_loaded_components
add_filter('customize_loaded_components', 'my_custom_filter', 10, 2);

function my_custom_filter($components, $manager) {
    // Your custom filtering logic here
    return $components;
}

Source Code Context

wp-includes/class-wp-customize-manager.php:359 - How this hook is used in WordPress core
<?php
 354  		 * @see WP_Customize_Manager::__construct()
 355  		 *
 356  		 * @param string[]             $components Array of core components to load.
 357  		 * @param WP_Customize_Manager $manager    WP_Customize_Manager instance.
 358  		 */
 359  		$components = apply_filters( 'customize_loaded_components', $this->components, $this );
 360  
 361  		require_once ABSPATH . WPINC . '/customize/class-wp-customize-selective-refresh.php';
 362  		$this->selective_refresh = new WP_Customize_Selective_Refresh( $this );
 363  
 364  		if ( in_array( 'widgets', $components, true ) ) {

PHP Documentation

<?php
/**
		 * Filters the core Customizer components to load.
		 *
		 * 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 {@see 'plugins_loaded'} action, so it cannot be added
		 * in a theme.
		 *
		 * @since 4.4.0
		 *
		 * @see WP_Customize_Manager::__construct()
		 *
		 * @param string[]             $components Array of core components to load.
		 * @param WP_Customize_Manager $manager    WP_Customize_Manager instance.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/class-wp-customize-manager.php
Related Hooks

Related hooks will be displayed here in future updates.