Skip to content

Excluding your Plugin from WordPress Update Checks

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!

Topic: WordPress
Tagged as: Code, developers, functions, privacy

Share on FriendFeed

{ 2 comments… read them below or jump to the comment form to add your thoughts }

  1. 1 Frank Pipolo January 19th, 2010 at 2:08 pm

    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

  2. 2 MICHAEL July 8th, 2010 at 11:49 pm

    This doesn't work .... the update message is still there :(

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
Any comments that look like spam will be treated as spam - this includes SEO titles and use of spurious keywords.

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/web site in attribution.