How To Remove Genesis Customizer Panels

I’ve created a cleanup file in my starter theme which quickly lets me remove all of the Genesis features that my child theme is not using.

One of the functions I’ve included allows me to quickly remove the Customizer panels for Genesis theme settings. To keep a panel, just remove it from the array of panel names.

<?php
add_filter( 'genesis_customizer_theme_settings_config', __NAMESPACE__ . '\\remove_genesis_customizer_panels' );
/**
* Remove redundant Genesis Customizer panels.
*
* @param array $config The config array for theme settings in the Customizer.
*
* @return array
*/
function remove_genesis_customizer_panels( $config ) {
$panels = [
'genesis_updates',
'genesis_header',
'genesis_adsense',
'genesis_color_scheme',
'genesis_layout',
'genesis_breadcrumbs',
'genesis_comments',
'genesis_archives',
'genesis_scripts',
];
array_walk( $panels, function ( $panel ) use ( &$config ) {
unset( $config['genesis']['sections'][ $panel ] );
} );
return $config;
}
view raw functions.php hosted with ❤ by GitHub

Reader Interactions

Leave a Reply

Your email address will not be published. Required fields are marked *