In this tutorial, I’ll show you how you can hide WordPress Plugin from the plugin while the plugin can still work in the background and be hidden from the Plugin List of your WordPress Admin Dashboard.
Hide WordPress Plugin from Single Site
You’ll just need to add the following snippet to your current WordPress theme’s function.php file:
function swp_hide_plugin() {
global $wp_list_table;
$hidearr = array('akismet/akismet.php');
$allplugins = $wp_list_table->items;
foreach ($allplugins as $key => $val) {
if (in_array($key,$hidearr)) {
unset($wp_list_table->items[$key]);
}
}
}
add_action('pre_current_active_plugins', 'swp_hide_plugin');
Here, you need to replace “akismet/akismet.php” with your plugin’s directory and file name.
This will hide your plugin from the WordPress Dashboard while the plugin can work simultaneously in the background.
Hiding plugin in WordPress Multisite Network
If you are willing to hide your plugin from WordPress Multisite, then the code snippet mentioned above will not hide the plugin from the network list. To make it work, use the following code snippet:
function mu_hide_plugins_network( $plugins ) {
// let's hide akismet
if( in_array( 'akismet/akismet.php', array_keys( $plugins ) ) ) {
unset( $plugins['akismet/akismet.php'] );
}
return $plugins;
}
add_filter( 'all_plugins', 'mu_hide_plugins_network' );
Conclusion
I hope with these snippets you’ll b able to hide the plugins you want. If you’re not willing to edit the functions.php file, you can also use Code Snippet Pro or WPCode to add the above snippets directly.