Skip to content

Instantly share code, notes, and snippets.

@nfsarmento
Created July 9, 2021 11:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nfsarmento/662849a9df9969fef43922c64ee8a816 to your computer and use it in GitHub Desktop.
Save nfsarmento/662849a9df9969fef43922c64ee8a816 to your computer and use it in GitHub Desktop.
Hide a WordPress plugin from plugin list
function ns_hide_plugin() {
global $wp_list_table;
$hidearr = array('wordfence/wordfence.php', 'updraftplus/updraftplus.php', 'wp-security-audit-log/wp-security-audit-log.php', 'simple-history/index.php', 'user-switching/user-switching.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', 'ns_hide_plugin');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment