customize_loaded_components
最后更新于:2021-11-26 04:05:20
apply_filters( ‘customize_loaded_components’, string[] $components, GC_Customize_Manager $this )
Filters the core Customizer components to load.
参数
- $components
-
(string[])
Array of core components to load. - $this
-
(GC_Customize_Manager)
GC_Customize_Manager instance.
源文件
文件: gc-includes/class-gc-customize-manager.php
/** * Removes the core 'Menus' panel from the Customizer. * * @param array $components Core Customizer components list. * @return array (Maybe) modified components list. */ function gcdocs_remove_nav_menus_panel( $components ) { $i = array_search( 'nav_menus', $components ); if ( false !== $i ) { unset( $components[ $i ] ); } return $components; } add_filter( 'customize_loaded_components', 'gcdocs_remove_nav_menus_panel' );
/** * Removes the core 'Widgets' panel from the Customizer. * * @param array $components Core Customizer components list. * @return array (Maybe) modified components list. */ function gcdocs_remove_widgets_panel( $components ) { $i = array_search( 'widgets', $components ); if ( false !== $i ) { unset( $components[ $i ] ); } return $components; } add_filter( 'customize_loaded_components', 'gcdocs_remove_widgets_panel' );