Andy Tran

Remove Additional CSS from the WordPress Customizer

by | Aug 27, 2021 | Wordpress

Sometimes, you do not want the Additional CSS option to appear on the WordPress Customizer when you are not willing to change the styling of your website. In that case, you can Remove the Additional CSS from the WordPress Customizer option to make sure that no one will add additional styles to your website.

Additional CSS is stored in the database, within the wp_posts table, under the custom_css post type, where the post name is the theme slug. There you also have the related customize_changeset and revision post types.

There are Four techniques for adding custom CSS to WordPress:

    • Using the Customizer
    • With a plugin
    • Editing the style.css file of your child theme
    • Editing the functions.php file of your child theme

Write the following code in your functions.php file to Remove Additional CSS from the WordPress Customizer.

    • Login to your WordPress Admin Dashboard.
    • Now from the left sidebar go to Appearance -> Theme Editor.
    • Go to functions.php file and write below code.

This code will remove completely the Additional CSS section from your WordPress site.

function customizer_remove_css_section( $wp_customize ) {
  $wp_customize->remove_section( ‘custom_css’ );
add_action( ‘customize_register’, ‘customizer_remove_css_section’, 15 );


Remove the Additional CSS for specific users based on their ID

function customizer_remove_css_section( $wp_customize ) {
    $user = wp_get_current_user();
    if ( $user->ID !== 1 ) {
      $wp_customize->remove_section( ‘custom_css’ );
add_action( ‘customize_register’, ‘customizer_remove_css_section’, 15 );

Remove Additional CSS from WordPress Customizer

Here are a few examples covering the best CSS tutorials for beginners.
W3Schools CSS Tutorial
Codeacademy Learn CSS

To Continue Learning,
you can refer our blogpost Hide the Product Price When Price Zero