Skip to content

Instantly share code, notes, and snippets.

@akshayagarwal
Created February 28, 2014 01:48
Show Gist options
  • Save akshayagarwal/9263649 to your computer and use it in GitHub Desktop.
Save akshayagarwal/9263649 to your computer and use it in GitHub Desktop.
Prevent a Wordpress Plugin from checking for updates
// Just add the following snippet in your plugin main file
// Code updated for Wordpress 3.8.1
add_filter( 'http_request_args', 'acs_prevent_update_check',10, 2 );
function acs_prevent_update_check( $r, $url ) {
if ( 0 === strpos( $url, 'https://api.wordpress.org/plugins/update-check/1.1/' ) ) {
$my_plugin = plugin_basename(__FILE__);
$plugins = json_decode($r['body']['plugins'], true);
if (array_key_exists($my_plugin, $plugins['plugins'])){
unset($plugins['plugins'][$my_plugin]);
}
$r['body']['plugins'] = json_encode( $plugins );
}
return $r;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment