[wp-hackers] Filter Plugin List

Mike Little wordpress at zed1.com
Sun Nov 11 21:51:32 UTC 2012


On 11 November 2012 20:44, CloudPress Hosting
<cloudpresshosting at gmail.com>wrote:

> I did not see anything in the codex filter reference page but I am looking
> for a filter to apply to the plugin list after everything has been loaded
> into it and is getting ready to be displayed. Could anyone point me in the
> right direction?
> _______________________________________________
>
>

I use this to hide certain plugins (I don't want them turned off) from some
clients:

add_filter( 'all_plugins', 'z1_remove_some_plugins' );
function z1_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 z1_remove_some_plugins



Mike
-- 
Mike Little
http://zed1.com/


More information about the wp-hackers mailing list