Skip to content

Instantly share code, notes, and snippets.

@davemac
Created November 25, 2012 23:47
Show Gist options
  • Save davemac/4145907 to your computer and use it in GitHub Desktop.
Save davemac/4145907 to your computer and use it in GitHub Desktop.
WordPress hide certain plugins
// thanks to Mike Little on WP-hackers
add_filter( 'all_plugins', 'dmc_remove_some_plugins' );
function dmc_remove_some_plugins( $all ) {
global $current_user;
$remove_these = array(
'limit-login-attempts/limit-login-attempts.php',
'wordpress-firewall-2/wordpress-firewall-2.php',
'update-notifier/update-notifier.php',
'wp-super-cache/wp-cache.php',
'audit-trail/audit-trail.php',
);
if ( isset( $current_user ) && ( 1 != $current_user->id ) ) {
foreach( $all as $file => $data ) {
if ( in_array( $file, $remove_these ) )
unset( $all[$file] );
}
}
return $all;
} // end dmc_remove_some_plugins
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment