Thanks for nothing, WordPress.
It’s not often that I complain about anything in WordPress, much less get genuinely angry about something I think is downright stupid, but today it happened.
I build a lot of WordPress sites for clients, and I frequently post them in a staging area on my server. Rather than having dozens of separate installations of WordPress filling up my server’s disk space, I set up a single installation (but with a separate database for each site), with some simple customizations to the wp-config.php
file that tell it which database to use based on the domain name.
Please don’t bother to mention that I should “probably” be running WordPress-MU (or MultiSite or whatever they call it now). Ultimately these sites are going to be hosted elsewhere as standalone WordPress sites so I need to keep their databases separate.
One key to making this arrangement work nicely has always been the simple setting in WordPress that allows you to define a special directory for uploads, instead of dumping them all in the main uploads directory. By setting this to a subdirectory under wp-content/uploads
named to match the site’s theme folder name, it was easy to keep everything separate.
It’s been a while since I’ve set up a new site on the staging server, at least since before I updated to WordPress 3.5. But I was doing one today, and I had to do a sanity check as I scoured the settings to try to find where in the hell you set the custom uploads path. I was sure it was under Settings → Media but I couldn’t find it there.
Because they took it out.
Yes, they took it out. Why? Well, apparently there’s a rational explanation, but frankly no explanation would satisfy me because it seems incredibly disruptive to take something like this out, even if it was a bad idea to implement it as it was in the first place.
Fortunately, there’s still a way to do it. You just can’t do it in the admin interface anymore; you need to edit the wp-config.php
file directly to add a constant. No problem, I’m already doing that anyway.
Here’s what you need:
define('UPLOADS', '/your/custom/path/under/wordpress/root');
If you’re just putting your uploads into a subdirectory under the main uploads directory, like I am, it would look like this:
define('UPLOADS', '/wp-content/uploads/yourdirectory');
Just remember, if you’re doing this because you’re running multiple sites from a single installation like I am, this constant should be set in the same conditional where you’re setting which database the site should use.
Easy. Not as easy as it was, nor as easy as I think it should be, but…