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.