How to Ensure that Users Do Not Deactivate The Critical WordPress Plugins

It’s no secret that among all the remarkably useful features of WordPress, its plugins occupy the top spot. The WordPress plugins are the tools that help the webmasters, irrespective of their technical acumen, to take their website beyond the defaults and add settings that can hand them over with complete control over their website.

Having said that, the plugins can also go a long way in increasing unnecessary load on a website and burdening the server to a point that the website’s speed is hampered to a large extent. There are several plugins that hardly serve the purpose they are installed for and instead upload far too many files on the server, rendering it slow.

Realizing this, many webmasters have started paying attention to the plugins they need and the plugins they don’t need. This way, they get a clear eyed picture as to which plugins should they uninstall from their website so that the load is minimized.

And this is also recommended by experts since some people are in the habit of installing random plugins that instead of providing their website with useful features go on to inject some malicious code in the site. So, the practice of not installing everything you come across and installing plugins that you don’t need in present or in near future serves webmasters well enough

That said, however, there is a huge possibility that a website owner, with not much technical knowledge, might end up uninstalling a crucial plugin that happens to be the core part of the website. Uninstalling or simply deactivating such a plugin may make the website unstable and eventually, the website owner may have to hire an expert to get the issue fixed.

Now, this is a scenario that WordPress developers are not really fond of. When they are creating a particular theme, they don’t want it to be on the mercy of the end users. In such a scenario, hiding the respective plugins from the list of installed plugins becomes all the more important. Apparently, if the user can’t see the plugin, he or she can’t deactivate or uninstall it.

How You Can Hide a Particular Plugin

innerwordpress-1769121

For what it’s worth, hiding a particular plugin from the list of installed plugins is also a breezy job. There is a small WordPress code snippet that will hide any plugin you want once that particular plugin is activated. Let’s say, you want to hide the W3 Total Cache plugin from the list so that this speed booster plugin permanently resides in the website and fights the speed-affecting factors uninterruptedly. Along with that, you mignt The code for hiding it has to be added to the functions.php file in your theme:

add_filter( 'all_plugins', 'hide_plugins');
function hide_plugins($plugins)
{
        // Hide Starbox plugin
        if(is_plugin_active('starbox.php')) {
                unset( $plugins['starbox.php'] );
        }
        // Hide W 3 Total Cache plugin
        if(is_plugin_active('W3Total Cache-Speed-optimizer/W3TotalCache.php')) {
                unset( $plugins['W3Total Cache-Speed-optimizer/W3TotalCache.php'] );
        }
        return $plugins;
}

This code will most certainly hide away the the plugins Starbox and the W3 Total Cache from the list so that they can’t even be accidentally deactivated or uninstalled.

Similarly, other plugins can also be uninstalled with a simple enough code.

add_filter( 'all_plugins', 'hide_plugins');
function hide_plugins($plugins)
{
                // Hide Share This Plugin
                if(is_plugin_active('wordpress-seo/sharethis.php')) {
                                unset( $plugins['sharethis/sharethis.php'] );
                }
                // Hide Akismet Plugin
                if(is_plugin_active('akismet/akismet.php')) {
                                unset( $plugins['akismet/akismet.php'] );
                }
                return $plugins;
}

More and more number of WordPress developers are using this code to safeguard the critically important plugins that command a permanent place in websites. If you are one of the WordPress developers wanting to find a way that hides your plugin from the installed plugins list, do try this out.

Author Bio :
Ben Wilson is working as a certified WordPress plugin developer at WordPrax Ltd – a leading WordPress CMS Development Services and Solutions Company. He loves sharing useful insights on WordPress plugins and their varied uses.

Scroll to Top