Posted on

Remove Additional CSS From the Customizer

WordPress 4.7 introduced a section in the Customizer called Additional CSS. This section should replace the Custom CSS option that many themes include in their Theme Options, or those plugins created for the same purpose.

Sometimes though, especially for developers, this could be a bad feature, because they don’t want their customers to edit CSS as they want.

How to remove the Additional CSS from the Customizer?

Open the file functions.php in wp-content/themes/your-child-theme-name/ and add this code at the end of the file:

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

Remove the Additional CSS Conditionally

What if you want to remove it for everyone except administrators? In that case you’d need to check the user role too, and you can do it so:

This code will remove the section for everyone who can’t manage_options, so everyone who is not Admin or Super Admin.

You can do even more, and leave it only for specific users based on their ID:

This code will remove the Additional CSS from any user that is not ID 1, which usually is the first user created when creating the WordPress site.

2 thoughts on “Remove Additional CSS From the Customizer

  1. I actually just built (customised) my first custom Genesis child theme entirely through the Additional CSS feature and of course the trusty functions.php file. The customizer has come a long way and as such probably introduces a lot of easy ways to break things if you don’t know what you are doing! I generally try and educate my clients and partners rather than restrict them, but I’m sure this snippet will be useful at some point!

    1. Personally I prefer to work always on files directly instead of using WP editors (both for PHP and CSS), but it’s just that I’m used that way.

      About customers, I prefer to restrict them if I can. They are not devs and they don’t need to know/have access to those things. I give them access to everything else, but not to code just to avoid them breaking stuff by mistake.

Leave a Reply

Your email address will not be published. Required fields are marked *