Skip to content

Instantly share code, notes, and snippets.

@alexwcoleman
Last active April 10, 2018 20:46
Show Gist options
  • Save alexwcoleman/c1fea0f4f12761a0a1905412d5dd4faa to your computer and use it in GitHub Desktop.
Save alexwcoleman/c1fea0f4f12761a0a1905412d5dd4faa to your computer and use it in GitHub Desktop.
Remote Media Loader: WordPress
<?php
/**
* Loads media from a remote site when on a local dev environment.
* Eliminates the need to download the uploads directory from the remote site for testing purposes.
* Just make sure to update the obvious URLs below 🤔👏🎉
* Also, throw this in your mu-plugins folder, or create a plugin for yourself.
*/
if ( 'yourbigfatwebsite.local' === $_SERVER['HTTP_HOST'] ):
add_filter( 'upload_dir', function ( $uploads ) {
$uploads['baseurl'] = 'http://yourbigfatwebsite.com/wp-content/uploads';
return $uploads;
} );
endif;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment