Forked from 21stcenturyblogger/RemoveCustomizerSections.php
Created
February 12, 2019 18:07
-
-
Save ChrisHursty/827ef8b932ebe8a5b9ce131efc4ad0b2 to your computer and use it in GitHub Desktop.
Remove common sections or panels from the WordPress theme customizer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Remove unwanted sections or panels in the theme customizer | |
// Add to child theme fuctions.php or child_theme_functions.php or child-theme-customizer.php | |
function remove_customizer_options_sections(){ | |
global $wp_customize; | |
// Normal customizer sections | |
//$wp_customize->remove_panel('nav_menus'); // Menus section | |
//$wp_customize->remove_section('title_tagline'); // Site Identity section | |
//$wp_customize->remove_control("header_image"); // Header Image section | |
$wp_customize->remove_section("background_image"); // Background Image section | |
$wp_customize->remove_panel("widgets"); // Widgets section | |
$wp_customize->remove_section("colors"); // Colors section | |
//$wp_customize->remove_section('static_front_page'); // Static Front Page section | |
// Genesis Specific Sections | |
//$wp_customize->remove_section('genesis_archives'); // Content Archives section | |
$wp_customize->remove_section('genesis_breadcrumbs'); // Breadcrumbs section | |
$wp_customize->remove_section("genesis_comments"); // Comments and Trackbacks | |
$wp_customize->remove_section("genesis_layout"); // Site Layout section | |
// WP SEO by yoast | |
$wp_customize->remove_section("wpseo_breadcrumbs_customizer_section"); // Yoast SEO Breadcrumbs section | |
} | |
// Important: Priority 20 so that we remove options only once they've been added | |
add_action( 'customize_register', 'remove_customizer_options_sections', 20 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment