Skip to content

Instantly share code, notes, and snippets.

@cyberwani
Created April 22, 2013 06:27
Show Gist options
  • Save cyberwani/5432824 to your computer and use it in GitHub Desktop.
Save cyberwani/5432824 to your computer and use it in GitHub Desktop.
Prevent any plugin from update check. This will help if you are customizing any plugin and it will let you stop the plugin update and not loose your changes. Add this code to your plugin.
<?php
add_filter( 'http_request_args', 'my_plugin_prevent_update_check', 10, 2 );
function my_plugin_prevent_update_check( $r, $url ) {
if ( 0 === strpos( $url, 'http://api.wordpress.org/plugins/update-check/' ) ) {
$my_plugin = plugin_basename( __FILE__ );
$plugins = unserialize( $r['body']['plugins'] );
unset( $plugins->plugins[$my_plugin] );
unset( $plugins->active[array_search( $my_plugin, $plugins->active )] );
$r['body']['plugins'] = serialize( $plugins );
}
return $r;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment