Skip to content

Instantly share code, notes, and snippets.

@tott
Created November 13, 2013 19:35
Show Gist options
  • Select an option

  • Save tott/7454982 to your computer and use it in GitHub Desktop.

Select an option

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