wp-content Β» plugins Β» How to hide a plugin from the WordPress plugins list πŸ™ˆ

How to hide a plugin from the WordPress plugins list πŸ™ˆ

wp-admin/plugins.php displays the plugins list table using the array $plugins_all which contains information on all installed plugins.

We can use pre_current_active_plugins hook to perform actions before the plugin information is displayed on this page.

TIP: The best way to understand what a hook does is to look at where it occurs in the source code.

for example to hide the Hello Dolly plugin from the plugins list:

function plugin_hide() {
  global $wp_list_table;
  // replace your plugin url here
  $hidearr = array('hello.php');  
  $myplugins = $wp_list_table->items;
  foreach ($myplugins as $key => $val) {
    if (in_array($key,$hidearr)) {
add_action('pre_current_active_plugins', 'plugin_hide');

So even though the plugin is active and physically present in the wp-content/plugins/ folder, it will be hidden from the wp-admin/plugins.php page.

I’ve seen this simple method used in various WordPress malware to hide malicious code so make sure to manually check the plugins folder when removing malware from hacked WordPress websites.

See also  wp_actionscheduler_actions & wp_actionscheduler_logs tables

Was this post helpful?

Leave a Comment

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.