WordPress popularity is touching new heights with passing time, and observing such unprecedented growth of this content management system it's not surprising to see website owners trying their hand into WordPress development.
If you're building a WordPress powered, it's certain that you would want to refrain your users from toying with the WP dashboard area. Besides, there can nothing be much worse than a client messing around things they hardly understand, as they'll most likely end up getting the site broken. Especially, if you've build and added some great WordPress plugins that are important for smooth website functioning, you would definitely don't want your users to to accidentally deactivate those plugins.
Fortunately, there are ways following which you can keep the users from deactivating the plugins. With this post I'll help you get familiar with ways that will limit user access to WP plugins.
Table of Contents
Hiding WordPress Plugins With Code
If you fear from getting some plugins in your WP powered site from getting deactivated by the users of your site, then you can either possibly explain the importance of those plugins to the users, or rather hide them by visiting the “Installed Plugins settings” in the dashboard. Wondering how? Well, once you have activated the plugin from “Installed Plugins settings”, make use of the following code to hide that particular plugin. You will need to embed the following code in the functions.php file present in your activated WordPress Theme.
add_filter( 'all_plugins', 'hide_plugins');
// Hide welcome note plugin
unset( $plugin_name['welcome.php'] );
The aforementioned code will hide ‘welcome note' plugin. Using the similar code as above you can deactivate any other important plugins added to the site. However, there is one minor downside to it that in case the user will remove the above code from the functions.php file, then the plugin that you've hided will become visible again.
Disabling the Dashboard Access to Users With Plugins
Most often, you can customize the WP dashboard merely with help of the built-in “Screen Options”. In order to have control over the users and limit their access to the dashboard and its plugins, there are two great plugins that you can install.
Admin Menu Editor: This is a great plugin that allows site owners to edit the Dashboard menu manually. With Admin Menu Editor you can hide some specific items, make changes to user access rights and more.
Capability Manager: This plugin helps in managing role capabilities. With the help of Capability Manager, you can tweak the capabilities of any role, add new capabilities and new roles, and even copy some pre-defined roles into new ones. You can also delegate capabilities management to other users. There is a Backup/Restore tool, which can be used to save your existing roles and capabilities, prior to making any changes. The tool will help you to revert the changes made in case something goes awry. It can be found in the Tools menu.
Clean WP Dashboard: This WordPress plugin doesn't get rid of any of the Dashboard menus, Screen Options, or Help button, but it helps in removing Dashboard widgets like Plugins, Incoming Links, etc. for all users.
If you've build some excellent plugins for your WordPress website that upon deactivation by the users can apparently break your site, or unable to perform some functionality that increased your search engine ranking (after deactivating WordPress SEO plugins) and so on, it's very important to tell your clients about the significance of those plugins. If they still continue to play with the plugins you can either use a code snippet or install WP plugins to hide the ones; both these methods have been explained in detail in the post.