Wordpress: use Remote Images for Development

if you have to dig into another customer’s Wordpress project it’s mostly not too hard to dump and import her current database. PhpMyAdmin and adminer come with buttons for it and mysqldump is your best friend if the content has grown too large.

But what about her assets? One of my clients got a media library that sums up to 3.2G and counting. After importing the database in my local machine the images are missing and of course I don’t want to download them!

Luckily, there’s a rather well hidden setting (at least I couldn’t find it within 10 minutes, that’s why I’m writing) in Wordpress that allows you to set the base url for images. It’s not visible in the frontend by default so hit your favorite db editor, seek wp_options for `upload_url_path` and change it to the remote server you want (including the base path, e.g.: https://images.some-domain.com/wp-content/uploads).

Once set Wordpress shows another “Uploading Files” section in the Media Settings so you can change it without touching the database once again. Still wondering why that field isn’t shown by default?! Whatever.

the new media setting appears once you set upload_url_path in the database

Another hint: This is also a perfect place to set a remote location when you want to serve your blog’s media from a totally different host — CDNs, Dropbox or Amazon’s S3 are a good example for these. Doing so might speed up your asset delivery by some 20–100% depending on the edge location. But that’s another story.

Thanks, WebNots for hinting me there.

Like what you read? Give Stefan Adolf a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.