Archived topic
Remove selected Customizer menus
9 replies · Started by Krzysztof on April 22, 2022
Hello,
I would like to remove some of the Customizer menus on a multisite install. I've seen this page https://docs.generatepress.com/article/remove-all-gp-customizer-options/ and inserted in my subsite's functions.php, but it doesn't work. I also tried https://wordpress.stackexchange.com/questions/250349/how-to-remove-menus-section-from-wordpress-theme-customizer, but that didn't work either. Are there any specific requirements for a multisite install to be able to do that?
Hi there,
how are you adding the function to your site(s) ?
I add it to my functions file on the child site's (under /wp-content/themes/generatepress_child/sites/[site_id]/functions.php). Tried also under the top functions file (/wp-content/themes/generatepress_child/functions.php), but that didn't work either...
Tried adding the code here: https://docs.generatepress.com/article/remove-all-gp-customizer-options/ in my functions.php file an it seems to be working as expected.
To confirm, can you check if any your custom functions are working when added in your functions.php file?
Kindly let us know. :)
Seems there's an issue with the newest version of the GP theme. I tried on multiple sites and had a problem with the code to work. However I had one with an older version of the theme (3.0.3) and when tested the code there, it worked. Immediately when I updated the theme to the newest (3.1.3), the code stopped working and the hidden elements in the customizer showed back. I had two sites with the older version of the GP theme and in both cases there was the same process - worked with the older version, but after update it stopped working.
Hi there,
Can you try the updated code?: https://docs.generatepress.com/article/remove-all-gp-customizer-options/
Let us know :)
Hello @Tom,
thanks for your reply. This modification works indeed. Thanks. However there are a few menu elements that are still present (site identity, menu, widgets, homepage settings and additional css). How to disable these elements? And how to disable other elements that may appear from other plugins and can be identified by their ID in the ul > li customizer's menu structure?
Thanks.
Hi there,
Site ID, Menu, Widgets and Homepage are all WP core panels, try this to remove them:
function remove_wp_customizer_panels( $wp_customize ) {
$wp_customize->remove_section( 'title_tagline');
$wp_customize->remove_panel( 'nav_menus');
$wp_customize->remove_section( 'static_front_page');
$wp_customize->remove_section( 'custom_css');
}
add_action( 'customize_register', 'remove_wp_customizer_panels',50 );
3rd party plugins - that will depend on how they hook their code into the Customizer.
You could use the Query Monitor Plugin to check what callbacks are being made against the customize_register hook that may provide you with some pointers.
Yes, that did the trick. Thank you support!
Glad we could be of help