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
- Issues with title-tag and document_title_parts
- Is it ok to use a function to output the text domain name in a wordpress theme
- Display random categories on the front page (Finding and Editing Theme Functions)
- Need help setting default setting value for radio button in theme customizer
- How to remove Customize from admin menu bar after WP 4.3
- How to get woocommerce inventory status [closed]
- TinyMCE custom styles remove class when switching styles
- How to use get_template_directory_uri() to load an image that is in a sub-folder of my theme?
- Is it possible to get a theme customizer setting from wp.customize using jquery?
- 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
- Organize functions.php
- How to override functions.php in child theme?
- Overriding core functions in child theme
- Dynamically change feature image in customiser
- One button to change all settings in theme customizer?
- Change parent theme file function in child themes functions.php
- Dequeue Scripts and Style for Mobile not working?
- Design view breaking on Pages
- Widgets Section not displaying in theme customizer
- Displaying Widgets
- Dequeue script in template isn’t working
- Using the child theme functions.php to change the customizer.php on parent theme
- Add external js file to footer with id
- Changing itemprop from logo to image on custom logo?
- 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
- Show excerpt for only first post in query
- How to add css class to image attached in all the posts?
- How to call custom function from functions.php in site-wide template files?
- 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]
- Is there a way to add a class to non current menu item?
- 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
- How to enable template page only for a post id page
- Why does the ‘wp_nav_menu’ function work only until a menu is created?
- Add caption functionality to custom WordPress theme
- is_customize_preview() like function to check if Customizer “Live Preview” in JavaScript
- How to Display a Plugin function (content) on frontpage using index.php
- Override a theme function in a child theme?
- Pulling Twitter RSS feed not working as expected (fatal error)
- Use register_setting() in a loop
- Best practices regarding the creation of custom widgets?
- 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
- Add Custom Background Properties to Customizer
- enqueue styles for only mobile wp
- 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?
- Can we create our own theme’s function.php?
- unnecessary request call for js and css after calling wp_dequeue_script
- Define PHP variable from a seperate API if statement
- Excerpt for pages not showing
- get_pages() Returns Only One Item
- 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
- Getting the teaser text without overriding global variables
- call_user_func_array() expects parameter 1 to be a valid callback, function
- why can’t i add front.css to my frontpage.php
- How to pass variables from one function to another or combine functions
- Different methods of adding menu support to custom theme
- “options.php” not found
- How to store a number (coming from cookie) into query vars for later usage in other filters?
- Is this an acceptable practice for WordPress theme development?
- What is the correct way to include my new functions and scripts in WordPress?
- wp_nav_menu work in functions.php but not in the theme
- Problem in using Customizer
- 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]