Why are you trying to change the location of file uploads? What’s the end goal with this?
We no longer desire to change to location of the uploads, but the other question remains. My boss requires files to be in the /images directory (so domain.com/images), because all our other sites have the files in /images.
My boss requires files to be in the /images directory (so domain.com/images), because all our other sites have the files in /images.
That would be called ‘Changing the location of file uploads’
WordPress uses /files/ instead of /images/ and … there isn’t a great way to do this (and actually I strongly suggest you not, unless there’s a compelling code reason). I would go back and tell my boss that the standard is /files/ because you may not always upload images.
I may have found a workaround, I would like to hear your opinion on this.
1. I changed RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L] into RewriteRule ^images/(.+) wp-includes/ms-files.php?file=$1 [L]
This way WP can still distinguish the files of separate blogs, and we get our /images directory (virtually).
2. As changing Fileupload Url does nothing (*), I dug in and put this in functions.php:
function filter_attachment_url($url=""){
$url = str_replace('/files/', '/images/', $url);
return $url;
}
add_filter('wp_get_attachment_url','filter_attachment_url');
(*) I still think having options in the settings that don’t work is a bit silly.
They do work, just not the way you’re thinking they do.
Could you enlighten me, please?