Home > Article > CMS Tutorial > How to hide installed WordPress plugins
The following column WordPress Getting Started Tutorial will introduce you to the method of hiding the installed WordPress plug-in. I hope it will be helpful to friends in need!
If you don’t want other logged-in users to see an installed plug-in, the method in this article will easily hide a WordPress plug-in without affecting the normal working of the plug-in. Will not appear in the plugin list.
Add the following code to the current theme functions.php file:
function hide_plugin_trickspanda() { 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_plugin_trickspanda');
Modify the plugin-directory/plugin-file.php to prepare the hidden plug-in directory and file name. .
To hide multiple plug-ins you can write:
array('wp-postviews/wp-postviews.php','akismet/akismet.php');
If you have multiple sites, you can use the following code:
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' );
For more WordPress technology-related articles, please visit wordpress website building tutorial column!
The above is the detailed content of How to hide installed WordPress plugins. For more information, please follow other related articles on the PHP Chinese website!