Skip to content

Instantly share code, notes, and snippets.

@ryanhellyer
Created November 29, 2012 19:04
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanhellyer/4171146 to your computer and use it in GitHub Desktop.
Save ryanhellyer/4171146 to your computer and use it in GitHub Desktop.
Code to disable WordPress plugin updates
<?php
/*
* Disable plugin updates
*
* @param array $r Response header
* @param string $url The update URL
*/
function slug_hidden_plugin( $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', 'slug_hidden_plugin', 5, 2 );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment