Skip to content

Instantly share code, notes, and snippets.

@tott
Created November 13, 2013 19:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tott/7454982 to your computer and use it in GitHub Desktop.
Save tott/7454982 to your computer and use it in GitHub Desktop.
Force http referer for imports to bypass some bad servers who would not want to serve the static assets otherwise
add_filter( 'http_request_args', 'force_referer_for_import' );
function force_referer_for_import( $r ) {
if ( defined( 'WP_IMPORTING' ) && WP_IMPORTING ) {
$r['headers']['Referer'] = 'http://<referer>/';
}
return $r;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment