Disable Additional CSS
Removes the Additional CSS panel from the Customizer and the custom CSS option in the Site Editor, so styles are only changed in code.
Opens WPIDE on
Code
add_filter( 'map_meta_cap', function ( $caps, $cap ) {
if ( 'edit_css' === $cap ) {
$caps[] = 'do_not_allow';
}
return $caps;
}, 10, 2 );
Notes
CSS that was already saved keeps loading on the site.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.