How To Remove Change Theme Option From Customized

Suppose Your Developing the Multisites and Each User are Who are Registered For Sites can access all the Dashboard And You have Given the User to access only Customizer Than In Customizer There is any option to Changes the Theme
If you Want to Restrict the User to Change the Theme Or You need to Remove the Change Theme Option from the Customizer For the You need to Follow the Steps
You can Create a Simple Plugin to remove the Theme Option or You can Pass the following Code in the Function.php
To create the Plugin we need to Create a Folder at Plugin Director as shown in the Below image
Here We have Created the Folder Called myCutomizer in that folder weto create a PHP file that is myCutomizer.php
write the Following code and activte the plugin at backend
<?php
/*
Plugin Name: Your plugin name
*/
 
function theme_option_remove( $wp_customize ) {
$wp_customize->remove_section("themes");
}
add_action( 'customize_register', 'theme_option_remove' );
?>
If still, you are Seeing the Theme option in Customized you Need to Add priority to the hooks as shown below
 function theme_option_remove( $wp_customize ) {
$wp_customize->remove_section("themes");
}
add_action( 'customize_register', 'theme_option_remove' ,20 );
If you Not able to Create the Plugin you write the Following code in the FUnction.php
function theme_option_remove( $wp_customize ) {
$wp_customize-&gt;remove_section("themes");
}
add_action( 'customize_register', 'theme_option_remove' );
Still not removed the theme option past below code in funciton.php with priority
function theme_option_remove( $wp_customize ) {
$wp_customize->remove_section("themes");
}
add_action( 'customize_register', 'theme_option_remove' );

0 comments:

Post a Comment

Don't Forget to comment