The Personal Website of Ronald Huereca

WordPress: Selectively Disable Plugin and Theme Editors, and Updates

Let’s face it, not all of us work in ideal situations. Some of us can create a site for a client, create only one administrator, and leave the client with lower privileges so that they are always at our mercy.

Other times you decide to throw up Multisite just so the client can technically be an administrator, but cannot update, add, or edit plugins and themes (much less update WordPress).

Admins, admins, everywhere!

The world I live in, everybody’s an admin. Sure, it’s not an ideal solution at all, but you have to work with what you have, right?

Today I created a snippet (with a lot of borrowed code) that will disable the plugin/theme editors, and will also disable updates from showing. All you have to do is throw it into your theme’s functions.php file.

I would guess that most of the clients, copywriters, etc, do not know the power that they hold when they are administrators. This snippet simply “hides” some of that power.

Disable by default, but allow enabling

Now if an admin really knows what they’re doing, they can “opt-in” to the plugin/theme editor and WordPress upgrade notices.

All the admin has to do is go to their user profile and select which options to opt-in on.

So in a nutshell, this snippet (by default) disables:

  • The ability to edit, delete, install, or update plugins.
  • The ability to edit, delete, install, or update themes.
  • The ability to upgrade WordPress. All notices are hidden.
Administrator Opt-in Options
Administrator Opt-in Options

Here be the code!

View it on GitHub or browse below.

Writer and software engineer Ronald Huereca has been a developer at notable agencies like iThemes and 10up. His varied background has him working with WordPress since 2006, eventually creating his own plugin which, of course, lead to more. He spends quite a bit of his time volunteering with the WordPress project as a core and polyglot contributor. With all of his passions, writing has been the way Ronald expresses himself best. He has written both technical books as well as fiction. Some of his works include Project Mayhem, Mindefusement, and WordPress and Ajax. “You can only delay the inevitable” is his favorite quote. Ronald enjoys reading Stephen King and John Grisham. When he’s not writing, Ronald dreams of building websites filled with cats yawning, disclaimers his strong opinions, sings karaoke, and advocates for empathy surrounding mental health.

Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top