Hide certain theme options under customizer for certian user roles

Question

I’d like to hide only certain theme options from certain logged in users (editor role). What do I need to add to the below? The below works but also removes it for the Admin user. I would like to deny other user roles access to the below section inside the customizer.


function my_customize_register() {     
global $wp_customize;
//$wp_customize->remove_panel( 'woocommerce' );  //Modify this line as needed  
$wp_customize->remove_panel( 'widgets' );  //Modify this line as needed
$wp_customize->remove_section( 'section-sidebars' );  //Modify this line as needed
$wp_customize->remove_section( 'section-footer-group' );  //Modify this line as needed

} 

add_action( 'customize_register', 'my_customize_register', 11 ); 
0
, , , user2498396 3 years 2020-06-08T05:10:27-05:00 0 Answers 83 views 0

Leave an answer

Browse
Browse