Change WordPress upload path and URL


On a fresh install, I want to move the upload folder to a subdomain (supposed to speed up download). My subdomain links to a folder called static. So I have:

  • Home
    • wp
      • wp-admin
      • wp-content
      • wp-include
    • static

Now I need to tell WordPress where the upload folder is and define its URL. The codex says I should edit wp-config to define UPLOADS relative to ABSPAHT. But if I put define( 'UPLOADS', '../static' ); of course URL in pages are like //mydomain.tld/wp/../static/image.jpg

I’ve looked around, and found many different answers to that (filters, DB edit,…), some of them no longer true (since the media settings page no longer allows to change the upload folder) and some obviously wrong… I want to do it the right way.

I went to the wp-admin/options.php page and set upload_path = ../static and upload_url_path = http://static.mydomain.tld and that seems to work.

But is that how it’s supposed to be done?
And if developpers have removed these options from the media settings page, isn’t there a risk that the feature is later completely removed?

Mat 4 years 2020-03-26T08:50:59-05:00 0 Answers 119 views 0

Leave an answer