Skip to content

Instantly share code, notes, and snippets.

@SergSlon
Created December 21, 2013 09:34
Show Gist options
  • Select an option

  • Save SergSlon/8067312 to your computer and use it in GitHub Desktop.

Select an option

Save SergSlon/8067312 to your computer and use it in GitHub Desktop.
Prevent a WordPress Plugin from Updating
add_filter( 'http_request_args', 'dm_prevent_update_check', 10, 2 );
function dm_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