apply_filters( 'customize_loaded_components', array $components, WP_Customize_Manager $this )

Filters the core Customizer components to load.


Description Description

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 ‘plugins_loaded’ action, so it cannot be added in a theme.

See also See also


Top ↑

Parameters Parameters

$components

(array) List of core components to load.

$this

(WP_Customize_Manager) WP_Customize_Manager instance.


Top ↑

Source Source

File: wp-includes/class-wp-customize-manager.php

View on Trac


Top ↑

Changelog Changelog

Changelog
Version Description
4.4.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note content
    Contributed by Drew Jaynes

    Remove the ‘Widgets’ panel from the Customizer

    /**
     * Removes the core 'Widgets' panel from the Customizer.
     *
     * @param array $components Core Customizer components list.
     * @return array (Maybe) modified components list.
     */
    function wpdocs_remove_widgets_panel( $components ) {
    	$i = array_search( 'widgets', $components );
    	if ( false !== $i ) {
    		unset( $components[ $i ] );
    	}
    	return $components;
    }
    add_filter( 'customize_loaded_components', 'wpdocs_remove_widgets_panel' );
    
  2. Skip to note content
    Contributed by Drew Jaynes

    Remove the ‘Menus’ panel from the Customizer

    /**
     * Removes the core 'Menus' panel from the Customizer.
     *
     * @param array $components Core Customizer components list.
     * @return array (Maybe) modified components list.
     */
    function wpdocs_remove_nav_menus_panel( $components ) {
    	$i = array_search( 'nav_menus', $components );
    	if ( false !== $i ) {
    		unset( $components[ $i ] );
    	}
    	return $components;
    }
    add_filter( 'customize_loaded_components', 'wpdocs_remove_nav_menus_panel' );
    

You must log in before being able to contribute a note or feedback.