Wordpress: use Remote Images for Development

Stefan Adolf
Jun 10, 2018 · 2 min read

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.

Image for post
Image for post
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.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store