Hide Installed Plugins from Dashboard : Users can not deactivate the Plugin | Tutorial Freak – Online Tutorials

Hide Installed Plugins from Dashboard : Users can not deactivate the Plugin

wordpress-plugins

Hide Installed Plugins from Dashboard : Users can not deactivate the Plugin

wordpress-pluginsAs a WordPress Developer, Sometimes you dont want the user to deactivate certain plugins which are very essential for the site and the deactivation can also break up the entire site.

In such cases you can either explain the importance of those plugins to your client or to hide ”Installed Plugins settings” from the dashboard so that user won’t be able to deactivate it.

Here is a WordPress code snippet which will hide the plugin from “Installed Plugins settings” once the plugin is activated.For example,once the WordPress SEO by Yoast Plugin is installed and activated user cannot able to see the Plugin from Installed Plugins settings (Dashboard >> Plugins >> Installed Plugins) thus user cannot deactivate the plugin.

You need to add the following code in functions.php file of your active WordPress Theme.

add_filter( ‘all_plugins’, ‘hide_plugins’);
function hide_plugins($plugins)
{
// Hide hello dolly plugin
if(is_plugin_active(‘hello.php’)) {
unset( $plugins['hello.php'] );
}
// Hide disqus plugin
if(is_plugin_active(‘disqus-comment-system/disqus.php’)) {
unset( $plugins['disqus-comment-system/disqus.php'] );
}
return $plugins;
}

The above code will hide Hello Dolly plugin and Disqus comment system.Similarly you can deactivate WordPress SEO by Yoast and Akismet by adding following code.

add_filter( ‘all_plugins’, ‘hide_plugins’);
function hide_plugins($plugins)
{
// Hide WordPress SEO by Yoast Plugin
if(is_plugin_active(‘wordpress-seo/wp-seo.php’)) {
unset( $plugins['wordpress-seo/wp-seo.php'] );
}
// Hide Akismet Plugin
if(is_plugin_active(‘akismet/akismet.php’)) {
unset( $plugins['akismet/akismet.php'] );
}
return $plugins;
}

The only drawback is if user removes the coded from functions.php then it will be visible again.

KeithM..

Pro Photographer, WebMaster & Writer.. Please follow us on Facebook

KeithM.. – who has written posts on Tutorial Freak – Online Tutorials.


Help keep us alive & kicking, we need coffee 24/7, please donate, thanks!
Embed

Leave a Reply

      
      
      
             
      
  • Over100 Ways To Get Backlinks..