Skip to content

Instantly share code, notes, and snippets.

@dionysia
Created October 14, 2013 07:26
Show Gist options
  • Save dionysia/6972069 to your computer and use it in GitHub Desktop.
Save dionysia/6972069 to your computer and use it in GitHub Desktop.
Here is a WordPress snippet that will allow you to install the plugin and once it is activated it will be removed from the plugin screen so it can not be deactivated. The plugin will still be active and can be used as normal but it means that users can not deactivate these plugins. You can add the following into the theme functions.php file or c…
<?php
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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment