Last active
September 30, 2022 05:12
-
-
Save kulterryan/791a5f67010fbf4d15480e01a90af507 to your computer and use it in GitHub Desktop.
Hide a WordPress Plugin from Plugin List
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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