Skip to content

Instantly share code, notes, and snippets.

@kulterryan
Last active September 30, 2022 05:12
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 kulterryan/791a5f67010fbf4d15480e01a90af507 to your computer and use it in GitHub Desktop.
Save kulterryan/791a5f67010fbf4d15480e01a90af507 to your computer and use it in GitHub Desktop.
Hide a WordPress Plugin from Plugin List
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' );
function swp_hide_plugin() {
global $wp_list_table;
$hidearr = array('akismet/akismet.php');
$allplugins = $wp_list_table->items;
foreach ($allplugins as $key => $val) {
if (in_array($key,$hidearr)) {
unset($wp_list_table->items[$key]);
}
}
}
add_action('pre_current_active_plugins', 'swp_hide_plugin');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment