Site Administrator Adding CSS to WordPress

Hello!

We have a site administrator who wants to add CSS to his site on our WordPress multisite. Does anyone have suggestions on how this can be done if he is using a simple theme like twentyseventeen?

Thank you.

This is a native feature to WordPress these days under the Customizer How to Easily Add Custom CSS to Your WordPress Site Should work with any theme I believe.

Hey Tim.

The “Additional CSS” button in themes is only available to network administrators. Site admins don’t see the button in their dashboards. Adding a plugin would give any site administrator the ability to add unfiltered CSS code to their sites, which I think may cause more headaches than it’s worth. So, I’ve told the user that it’s not possible for now. I did refer him to the Enfold theme which let’s site administrators add some CSS code snippets.

Thanks for your suggestion.

Best.
Laurie

Ah I didn’t realize that feature was only for super-admins. Seems a bit silly to me, how much harm can someone do with CSS? I understand security risks of stuff like iframe embeds and things like that but I guess I wasn’t aware of any issue with CSS. It appears this plugin would be what you want if you do decide you want to enable that for individual site admins in the future Multisite Custom CSS – WordPress plugin | WordPress.org

There’s only 2 ways to safely and reliably do this. First one is, as Tim points out is to use Customizr > Additional CSS, but as Laurie points out, only the SuperAdmin rights can do that on a multi-site install.

The other route, and IMO, the better, is create a Child Theme. Plenty of documentation and even a plugin exists to help you create valid child themes.

Please, do not just change the CSS file(s) in the Theme itself. When the Theme updates your changes will break and be lost. Also don’t even think about not updating your Themes when updates are available. That way lies security issues.

“In case you have modified the CSS in the stylesheet of your WordPress theme or have changed the code in any core theme files, these changes will be lost after theme updates. You can prevent these kind of issues by only making CSS customizations through your WordPress dashboard under Appearance => Customize => Additional CSS (available since WP 4.7) or by using a child theme.”
From: https://www.mhthemes.com/support/lose-settings-when-updating-theme/

This is a problem I’ve found on campus because a lot folks taking/taken graphic design courses get taught HTML/CSS but not the proper WordPress way for changing things. They think “oh I just want to change this …” and jump right into the HTML/CSS without thinking through future support, security, updates, etc. Beware of folks who say “I know HTML/CSS - I can design websites” and then look down their noses at WP. It comes back to bite.

Great information! Thank you.

Weirdly enough, on a new 4.8.2 Multisite install, I tested setting up a test account with regular admin access, and I did see the Additional CSS option in the Customizer. Have you confirmed that this happens with other themes? There is a small possibility it’s a quirk in the theme, not WP core.

I would definitely go the other plugin route. That’s what I used before Wordpress added the feature to the Customizer. It is also worth checking the theme interface; many themes have their own place to enter custom CSS.

Jim, while a child theme can manage this, I think it’s overkill for just overriding CSS. Yes, you never want to edit the core theme. But having a raft of child themes gets messy. Besides, this means any changes an admin wants needs to be relayed to a super admin to edit the child theme. The real need for child themes is to add custom functions and to over-ride theme templates, footers, etc.

FWIW I used this plugin that allows you to add custom functions to a theme Code Snippets – WordPress plugin | WordPress.org without doing a child theme