Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable WordPress Custom css section on WordPress Customizer

Anyone can help me to locking/ disabling the Appearance -> Customizer -> Additional CSS area. on Wp-admin.

Screenshot

I read this codex https://codex.wordpress.org/Theme_Customization_API But didn't got any hook or function for disabling it. Actually, I don't need this, anyone developer's adding unnecessary CSS from here and this saving on the database. Please suggest any solution, If that is possible to do.

Thank you in advance for your valuable reply.

like image 354
Amit mishra Avatar asked Oct 19 '25 03:10

Amit mishra


1 Answers

You could try removing the section using the WP Customizer function hook:

function mytheme_customize_register( $wp_customize )
{
   $wp_customize->remove_section('custom_css');
}
add_action( 'customize_register', 'mytheme_customize_register' );

Obviously you can name the function to suit, but call this block in your theme's functions.php file and it should remove this admin section (it most likely has an ID of 'custom_css' but could potentially vary)

Source: https://codex.wordpress.org/Class_Reference/WP_Customize_Manager/remove_section#Parameters

like image 141
mquinn Avatar answered Oct 20 '25 18:10

mquinn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!