Skip to content

How To Hide A WordPress Plugin From Plugin List

I was recently working on a client site, which required me to create a custom plugin for his website. I wanted to hide the plugin from the user, as he was a beginner and the plugin contained some sensitive functions to run his website.

Sometimes, when your client hires you for something, and that work only requires you to install a plugin, you might want to hide that plugin from the plugin list. You won’t want your client to see that you charged him/her only for installing a plugin.

In this tutorial, I’ll show how you can easily hide a WordPress plugin from plugin list. The plugin will still work, but will not appear in the plugin list.

Just add the following snippet to your current theme’s 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');Code language: PHP (php)

Replace plugin-directory/plugin-file.php in above code with your plugin’s directory and file name. You can find this info by clicking on edit plugin link from the plugin list.

If you want to hide the plugin from your WordPress Multisite, then you above snippet will not remove the plugin from the Network admin list. Here’s a snippet that will work on the WordPress Multisite

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' );Code language: PHP (php)

I used Akismet as an example. You’d have to replace akismet/akismet.php with the directory and file name of the plugin you’re trying to hide.

48 thoughts on “How To Hide A WordPress Plugin From Plugin List”

  1. What happens when they update their theme and the functions,php is over-written? Wouldn’t it be better to make it an automatic ‘include’ somewhere?

    1. FuckedlnTheHead (@FuckedlnTheHead)

      Terence,

      Create a directory called wp-content/mu-plugins

      Inside this directory create any php file and drop the function in there. This file will always be loaded by WordPress as it is in the “Must Use Plugins” directory.

      You’re welcome.

  2. The problem with the child-theme approach is that there isn’t always one present, so that would mean creating and installing one first. I would much rather SSH in and be able to drop something quickly into mu-plugins, or something similar. Wouldn’t you?

    1. It pretty much depends on the site. If I have pretty much access to everything then I’d add it in a custom plugin. It makes sense to add it to /mu-plugins/ folder.

  3. Yes, I thought so too. In fact I thought all I would need to do is top and tail “” but the code doesn’t seem to want to work as an mu-plugin. Any idea why it wouldn’t work?

    1. Replace the 4th line with the following code and tell me if it’s working:

      $hidearr = array(WP_PLUGIN_DIR.'plugin-directory/plugin-file.php');

    1. I can’t help with that issue cuz I never really used WordPress Network for a personal project to fork the plugin and all that stuff.

      Just try to point to the directory where the plugin file is located and it should work :)

  4. The file isn’t in any other directory. There is only one location for the file. So I think what we have discovered is that this method doesn’t work with multisite.

  5. Thanks Hardeep. It works very well with single-site either as a plugin or in functions.php. Its just the method of making it persistent beyond a theme update that’s bugging me.

  6. The code did not work in wordpress single site…so I modified it to work correctly

    /* JULIAN CODE */
    function hide_plugin_trickspanda()
    {
    global $wp_list_table;
    $hidearr = array(WP_PLUGIN_DIR.’folder/executable.php’);

    $myplugins = $wp_list_table->items;

    foreach ($myplugins as $key => $val)
    {
    $Tool = ‘wats/wats.php’;
    echo’alert(“‘.$key.'”);’;
    echo’alert(“‘.$Tool.'”);’;

    if($Tool == $key)
    {
    unset($wp_list_table->items[$key]);
    }

    }

    }

    add_action(‘pre_current_active_plugins’, ‘hide_plugin_trickspanda’);

    /*END*/

    1. Make sure to activate the plugin that you put this code into it. I use this code into my daily stuff and it always works :)

        1. The code which is in the article. I have updated the article with a new snippet to hide it from the Network admin as well.

  7. Hi!

    Great – Just what I was looking for.
    I often help clients that also are admins?

    How can I hide plugins and updates for all users also admin – except me?

    Lets say I am user “Netz” or ID 77 ??

  8. Let me just be clear… When I say “HIDE”… I mean not in the Menu, not in the plugin list – Not anywhere!?
    Only me meself and I can see the plugin and possible updates :-)

        1. Your client will be the admin. You’ll get the developer role and he won’t be able to see this developer plugin.

          1. Okay… I installed it… It can only hide core, updates, themes etc. Not single plugin
            Lets say I have a “Peter-Coded” plugin that I don’t want him to see anywhere – For my eyes only?
            I don’t want to prevent him from all the “normal” admin stuff (He is not suppose to realise that I am hiding my plugin for him). And other admins ( we are five) wont be abel to see or copy my code.

            1. Then you can hide the plugins from the list using this snippet + you can use a role managing plugin to grant/revoke some access from him, such as updating plugins and all.

    1. Me again … If I have two or more plugins to add…? Can I add them in th Array? like this:

      function hide_plugin_trickspanda() {
      global $wp_list_table;
      $hidearr = array(‘plugin-directory1/plugin-file1.php,plugin-directory2/plugin-file2.php,plugin-directory3/plugin-file3.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’);

      Or do I create a function hide_plugin2_trickmefast()

      :-)

      1. Try to create an array like this:


        $hidearr = array();
        $hidearr[] = array('plugin-directory/plugin-file.php');
        $hidearr[] = array('plugin-directory/plugin-file.php');

        1. Thanks a million Hardeep Asrani
          I got the combi of the plugin and your trick to work for me… :)
          Have a great day!

          Peter

      2. wordpress\wp-content\themes\minezine

        in ‘ functions.php ‘ where should exactly add this code ?
        should I change something more on Code?

        function hide_plugin_trickspanda() {
        global $wp_list_table;
        $hidearr=array();
        $hidearr[] = array(‘restrict-categories/restrict-categories.php’);
        $hidearr[] = array(‘role-scoper/role-scoper.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’);

        Thank you!

          1. I added the code but the plugin ‘JigoShop’ still on the left bar …
            please help

            function hide_plugin_trickspanda() {
            global $wp_list_table;
            $hidearr=array();
            $hdiearr[] = array(‘jigoshop/jigoshop.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’);
            ?>

              1. Sure,

                here’s http://pastebin.com/iMzUgr4M

                Btw, I am trying to make a Multiside webpage that each user may have their own profile where they can see only their own posts, pages,

                i tried some code but it did not work

                please help
                Thank u very much in advance,

                1. Sorry for late reply but a friend of mine passed away so I was busy with his funeral and services.

                  I see the error in your code, which is a minor error.

                  Replace:

                  $hidearr[] = array(‘jigoshop/jigoshop.php’);

                  with:

                  $hidearr[] = array('jigoshop/jigoshop.php');

        1. Hi Hardeep! Thank you for the code, it works!

          But it works only for a single plugin, How can I hide two or more plugins, I have seen one comments and you have listed a solution to use $hidearr = array();
          $hidearr[] = array(‘plugin-directory/plugin-file.php’);
          $hidearr[] = array(‘plugin-directory/plugin-file.php’);

          But that doesnt work,

          Can you pass me the full code?

          Thank you in advance!

        2. Hi,

          I have different question when are under chrome and click F12 you have developer mode. Now under Sources-sources->yourwebsite you can see list of current plugin.
          Do you know how to remove this list. Everyone can see what plugins are in use ?

          Regards,
          Radek

          1. Unfortunately, it’s not possible to remove it from the source code. But at the same time, no one checks the source code in admin page to see which plugins that site is using. :)

        3. Hey,

          Thanks for this.

          The second snippet works when I add it to functions, but it doesnt work when I add it to a mu-plugin in wp-content/plugins/mu-plugins/filename.php or wp-content/mu-plugins/filename.php

          Any ideas on how to get it working in a MU plugin?

          Thanks a lot.

        4. This is an older post, but it shows in search results. My question is how to list any plugins that are hidden – those that don’t show up in the Admin, Plugins list for an Administrator (or SuperAdministrator) role.

          SInce plugins can be hidden, a ‘nefarious actor’ could use a hidden plugin on a site to perform their ‘evil’ tasks. How would you show such a hidden plugin for further investigation?

        5. Although this code works, it does not remove the ‘settings’ screen for the plugin. And remember that a plugins Settings screen can be anywhere.

        Leave a Reply

        Your email address will not be published. Required fields are marked *