This Blog will guide you to hide a WordPress Plugin from Plugin list. Plugins helps you to achieve any functionalities which may take many hours to custom code. Recently we developed a WordPress for a customer who has less technical knowledge about codes and plugins. He demanded if we can hide all complex plugins from plugin list to avoid any chance of mess. His demand make sense so we decided to hide few plugins from plugin list via a code in functions.php file.
Table of Contents
Code to hide a WordPress Plugin from Plugin list in Single Site
So below is the code which we used to hide the plugins from plugins list in dashboard of WordPress admin.
function hide_pluginlist_scriptfeeds() {
global $wp_list_table;
$hidearr = array('plugin-directory/plugin-file.php');
$myplugins = $wp_list_table->items;
foreach ($myplugins as $key => $val) {
if (in_array($key,$hidearr)) {
unset($wp_list_table->items[$key]);
}
}
}
add_action('pre_current_active_plugins', 'hide_pluginlist_scriptfeeds');
Please note : You have to replace plugin-directory/plugin-file.php in above code with your plugin’s directory and file name.
To find this by simply click on Plugins -> Plugin File Editor and select the plugins from drop list which you want to add in code. Check image below.
Here we used “Advanced Editor Tool” as an example. So we will replace tinymce-advanced/tinymce-advanced.php in above code.
To hide Plugins from Plugin list in Multisite, follow below code with same process
function mu_hide_pluginslist_network( $plugins ) {
// let's hide akismet
if( in_array( 'plugin-directory/plugin-file.php', array_keys( $plugins ) ) ) {
unset( $plugins['plugin-directory/plugin-file.php'] );
}
return $plugins;
}
add_filter( 'all_plugins', 'mu_hide_pluginslist_network' );
So that’s all you need to hide So that’s how you can hide a WordPress Plugin from Plugin list. Give a try to above code and let us know how it works. You can also contact our Developer team for help.
Happy coding 🙂