Home > CMS Tutorial > WordPress > body text

How to hide installed WordPress plugins

藏色散人
Release: 2019-12-12 15:16:23
forward
3305 people have browsed it

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!

How to hide installed WordPress plugins

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');
Copy after login

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');
Copy after login

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' );
Copy after login

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!

Related labels:
source:zmingcx.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!