If you are a plugin developer for WordPress, or write your own plugins for personal use, you may wish to block these from WordPress update checks. WordPress automatically (and without notifying users) gathers private data from the backend and sends it home to wordpress.org every twelve hours.
The way the update check has been written, WordPress (the software) doesn’t know whether a plugin is listed in the WordPress.org repositories so has to send data back about them all for checking against the repository files. For some people, this raises privacy concerns, particularly where non-distributed plugins contain private data. For others, excluding a custom plugin avoids name collisions with plugins in the repository that may have the same name.
If you wish to exclude one of your plugins from the update array the following code will do the trick.
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 );
Just change the cws_hidden_plugin_12345 string (two instances) to a namespaced function name for your plugin and you’re good to go.
Code courtesy of Mark Jaquith.
If you enjoyed this post, make sure you subscribe to my RSS feed!














{ 1 comment… read it below or jump to the comment form to share your opinion }
Great tip as I use a paid theme for my WP blog and if it is not supported with the new WP its can bomb out my site. This way I dont have to see the updates anymore
Thanks
Leave a Comment