Skip to content

Instantly share code, notes, and snippets.

@spacedmonkey
Last active August 29, 2015 14:09
Show Gist options
  • Save spacedmonkey/77e7299e10204414fafb to your computer and use it in GitHub Desktop.
Save spacedmonkey/77e7299e10204414fafb to your computer and use it in GitHub Desktop.
function change_aggregator_remote_get_url($url){
$parse = parse_url($url);
return str_replace($parse['host'], "localhost", $url);
}
add_filter('aggregator_remote_get_url', 'change_aggregator_remote_get_url');
function change_aggregator_remote_get_args($args, $url){
$parse = parse_url($url);
$args['blocking'] = true; // Not required for us
$headers = (array)$args['headers'];
$headers['host'] = $parse['host'];
$args['headers'] = $headers;
return $args;
}
add_filter('aggregator_remote_get_args', 'change_aggregator_remote_get_args', 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment