Created
May 19, 2017 14:31
-
-
Save nigelheap/9b1f6415b4aea1c42f2532b31218b9e2 to your computer and use it in GitHub Desktop.
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
<?php | |
add_filter('http_request_args', function( $r, $url ) { | |
if ( 0 === strpos( $url, 'https://api.wordpress.org/plugins/update-check/1.1/' ) ) { | |
$blocked_plugins = array( | |
'plugin_name_1', | |
'plugin_name_2', | |
'plugin_name_3' | |
); | |
if (!empty($blocked_plugins)){ | |
foreach ($blocked_plugins as $plugin){ | |
$plugins = json_decode($r['body']['plugins'], true); | |
if (array_key_exists($plugin, $plugins['plugins'])){ | |
unset($plugins['plugins'][$plugin]); | |
} | |
$r['body']['plugins'] = json_encode( $plugins ); | |
} | |
} | |
} | |
return $r; | |
},10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment