The first thing to try is to increase the priority of your customize_register
action from the default of 10
to something like 100
. The reason for this is other components add their sections and controls in the same action and some after 10
, so the things you are trying to remove may simply not have been added yet.
The second thing to note is that Widgets and Menus are a special case and they should not be disabled in this way. Instead, there is a dedicated filter you use to prevent them from getting loaded:
add_filter( 'customize_loaded_components', '__return_empty_array' );
For more see the hook docs.
See also my post on how to reset the Customizer to a blank slate.
Related Posts:
- Add inline css to theme
- Combine two active_callbacks into one on theme customizer
- WP Customizer API loaded into functions.php
- Is it ok to use a function to output the text domain name in a wordpress theme
- Need help setting default setting value for radio button in theme customizer
- How to remove Customize from admin menu bar after WP 4.3
- TinyMCE custom styles remove class when switching styles
- Show/hide Widgets in Dashboard Based on Current Advanced Custom Fields Option
- Return only top-level navigation items from a menu using wp_get_nav_menu_items
- Overriding core functions in child theme
- Dynamically change feature image in customiser
- Dequeue Scripts and Style for Mobile not working?
- Design view breaking on Pages
- Widgets Section not displaying in theme customizer
- Displaying Widgets
- Using the child theme functions.php to change the customizer.php on parent theme
- Add external js file to footer with id
- How to add background image control to page admin controls?
- How to load some jquery code to make validation in the theme customizer?
- Best Practice for Syncing Local Development With Staging Development [closed]
- Overwrite Parent Theme add_image_size in Child Theme
- How to use thumbnails in gallery?
- Customizer field value into functions.php variable
- Logic to Print/echo a css class only for 1st post and ignore all post after 1st? [closed]
- PHP files included in functions.php don’t seem to work
- When using wp_enqueue_script(); in a theme why don’t we use add_action?
- How to use Internationalized human_time_diff() function in Chinese?
- is_dynamic_sidebar always returns true while using Jetpack visibility
- Why does the ‘wp_nav_menu’ function work only until a menu is created?
- is_customize_preview() like function to check if Customizer “Live Preview” in JavaScript
- Override a theme function in a child theme?
- Pulling Twitter RSS feed not working as expected (fatal error)
- Use register_setting() in a loop
- Add dynamic links in WordPress custom theme
- WordPress menu link doesn’t work properly
- Search filter by Post title OR Meta Title Value [duplicate]
- how can I edit flexslider in woocommerce. [Urgent]
- admin-ajax.php + load-scripts.php hanging for minutes
- Jquery implementation not working on page reload
- Unique sequential reservation code
- Skt full width basic slideshow problem
- Usage of theme name in functions
- Theme Customizer not loading JS for live preview
- Functions.php Problem
- ACF not showing
- How to customize the_archive_title()? Cannot figure out how to change the value it produces [duplicate]
- Control the srcset much more (not all sizes in it each time)
- Check if the image size is available and if not use ‘full’ image size
- Way to store featured image width and height in two separate variables?
- Excerpt for pages not showing
- laoding bloginfo url in function array?
- Some questions about how proper add 2 CSS file in a WordPress theme?
- Does size of a theme’s functions.php file matter?
- Functions php shortcode for displaying main menu with no child items
- get_next_posts_link() returns no result despite available posts
- Nav menus all outputting the same links
- PHP 7.1 | Warning: A non-numeric value encountered in
- Where do I go to edit this area? [closed]
- Woocommerce image sizes missing from Appearance › Customize but not declared by theme
- How to insert class in each list of categories?
- I can’t add CSS with functions.php
- call_user_func_array() expects parameter 1 to be a valid callback, function
- why can’t i add front.css to my frontpage.php
- Different methods of adding menu support to custom theme
- Is this an acceptable practice for WordPress theme development?
- Rewrite Question Mark in Post Template with URL Parameter for clean URLs
- contact form in template with jquery,validate and ajax
- Why a SlideShow (made using JQuery FlexSlider) can’t work if I load it form functions.php but work if I load it from my footer.php file? [closed]
- Need advice on theme customizer and child themes
- Theme Customizer – Custom Sections Display, but do Nothing
- Woocommerce Variable Product Dropdown for Custom Shop Template
- Astra theme – cannot set short product description under the product title (product name)
- How to fix Function create_function() is deprecated in / themes
- Exclude specific post from query
- Advanced method to control cache of enqueued style/script
- require get_template_directory() . ‘path/to-my/file.php’ BREAKS customize > themes functionality
- Can I use ‘Featured Image’ as a hero image and a thumbnail?
- Is_Page doesnt detect my page
- Test CDN link from function.php or wp_enqueue_script/style?
- How to customize archive widget only for cpt?
- wp_title() return random number
- How to offset main query without affecting other queries and backend
- Change default color scheme in twentyfifteen child theme?
- Add meta data in head from theme
- what is `get_section()` and how to use it?
- Remove External Links from WordPress posts Using add_filter() in Theme functions.php
- How to create a WordPress Customizer Button to Clear a Cache?
- HowTo: Add wrapper to columns shortcode?
- How to create admin ajax function for my contact form
- How to disable site title and description when custom header is uploaded on the customizer?
- Load a Child Theme’s style.css just before the closing tag
- Can’t wrap my head around this function – any help would be appreciated
- Allow tags and attributes in post and pages content
- How to add button to top of theme customizer?
- Add the title of a widget as an ID – for anchor links
- Why functions metaboxes is causing White Screen in Admin [closed]
- Getting error on function.php
- Custom customizer CSS priority
- Custom HTML structure in customizer not rendring in Browser
- Customizer cuistom CSS Priority ordre Issue