Skip to content

Instantly share code, notes, and snippets.

@jamiehs
Created March 3, 2014 05:07
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 jamiehs/9318743 to your computer and use it in GitHub Desktop.
Save jamiehs/9318743 to your computer and use it in GitHub Desktop.
Allows WordPress' importer to import media assets from one localhost site to another www.site1.dev to www.site2.dev (localhost sites). It seems that the WordPress wp_http_validate_url() function disallows the opening of URLs from the same host (127.0.0.1)
<?php
add_filter( 'http_request_host_is_external', 'explicitly_allow_same_host_requests_for_import' );
function explicitly_allow_same_host_requests_for_import(){
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment