Created
February 28, 2014 01:48
-
-
Save akshayagarwal/9263649 to your computer and use it in GitHub Desktop.
Prevent a Wordpress Plugin from checking for updates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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