Hide wordpress plugins from list

RE: Excluding plugins from update checks

Yes you can exclude plugins from the update checker, there’s no pretty solution, ie. no convenient filter to just say, here exclude these for me, but it can be done, Mark Jaquith did a blog on it a while back(and it is a relatively easy solution).

/**
 * FOR PLUGINS
*/
function cws_hidden_plugin_12345( $r, $url ) {
    if ( 0 !== strpos( $url, 'http://api.wordpress.org/plugins/update-check' ) )
        return $r; // Not a plugin update request. Bail immediately.
    $plugins = unserialize( $r['body']['plugins'] );
    unset( $plugins->plugins[ plugin_basename( __FILE__ ) ] );
    unset( $plugins->active[ array_search( plugin_basename( __FILE__ ), $plugins->active ) ] );
    $r['body']['plugins'] = serialize( $plugins );
    return $r;
}

add_filter( 'http_request_args', 'cws_hidden_plugin_12345', 5, 2 );
/**
 * FOR THEMES
*/
function cws_hidden_theme_12345( $r, $url ) {
    if ( 0 !== strpos( $url, 'http://api.wordpress.org/themes/update-check' ) )
        return $r; // Not a theme update request. Bail immediately.
    $themes = unserialize( $r['body']['themes'] );
    unset( $themes[ get_option( 'template' ) ] );
    unset( $themes[ get_option( 'stylesheet' ) ] );
    $r['body']['themes'] = serialize( $themes );
    return $r;
}

add_filter( 'http_request_args', 'cws_hidden_theme_12345', 5, 2 );

Source: Excluding your plugin or theme from update checks.


RE: Excluding plugins from the plugins list

Yes, quite possible, i wrote myself a plugin for doing just this but you’re more than welcome to the code.

Plugin Hider – pulled straight from my dev environment copy, so make your own adjustments as necessary.

Personally i mark all the plugins i want to hide with Author: hideme and that covers the lot for me(nothing i’ll distribute so marking them that way isn’t a problem).

If you try the plugin out, click the Plugin Hider link in the menu to set it up, it’ll do the rest. You can of course comment out the code that creates the menu item once you’ve got it setup, just be sure not to forget you have a plugin that hides others(couple of times i’ve had myself in circles as a result).


Hope that addresses your question… 🙂

Leave a Comment