Skip to content

Instantly share code, notes, and snippets.

@johanoloflindberg
Forked from ekandreas/functions.php
Created July 8, 2017 03:20
Show Gist options
  • Save johanoloflindberg/9a9b0ac0e64153cafe40165956979dac to your computer and use it in GitHub Desktop.
Save johanoloflindberg/9a9b0ac0e64153cafe40165956979dac to your computer and use it in GitHub Desktop.
Block external WordPress API request
/**
* Block external WordPress API request
*/
function wp_api_block_request($pre, $args, $url)
{
if (strpos($url, 'api.wordpress.org')) {
return true;
} else {
return $pre;
}
}
add_filter('pre_http_request', 'wp_api_block_request', 10, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment