How to Change the Default WordPress Uploads Folder

Did you know that WordPress can use any folder you specify for storing media uploads?
There are many different reasons users might want to change the default upload directory in WordPress. It makes it possible to host images on a subdomain for performance reasons, which can also make backups more efficient. People also sometimes change this directory in order to create a different URL structure and organization for their media files.

Before WordPress 3.5 you used to be able to change the upload directory path from the Settings menu in the dashboard. Unfortunately, it’s not that easy anymore, but it’s still possible.

How to change the default media upload directory

Open up your wp-config.php file, located at the root of your WordPress installation, and add the following code:

1
define('UPLOADS', 'wp-content/myimages');

The codex specifies that it should be added before the line that says require_once(ABSPATH.’wp-settings.php’);.

If the directory that you are defining does not yet exist, WordPress will automatically create it as long as wp-content is writeable. Otherwise you can just go in and create the directory yourself via FTP. Make sure to make the new directory writeable.

Change upload organization

You can also change the way WordPress uploads are organized. Navigate to Settings > Media in the dashboard and you’ll find the option to check or uncheck the box next to “Organize my uploads into month- and year-based folders”.

Settings > Media

Changing your file organization so all your media files go into one folder will help to make your URLs simpler. It also makes it easier to see all of your files in one place via FTP instead of having to rifle through multiple month and year directories.

photo credit: Thomas Hawk via photopin cc

Tags ,

Comments (5)

  1. One thing to watch out for is the permissions of the new uploads folder. If it’s set incorrectly, you won’t be able to view images and you’ll think that the upload or thumbnail creation failed, when in actuality the permissions are wrong.

  2. I would like to know if defining the UPLOADS constant in wp-config.php has any effects on a WordPress multisite install, and if so, what are they?

    Also, I couldn’t help notice that WPMU.org organizes its uploaded media by date-based folders. That made me wonder if it is configured like so due to the considerate number of authors who publish on the blog, whereas a single folder could get messy.

  3. Hi,

    Will changing the uploads folder name to something else add any security benefit?

    There are many ways to harden wordpress once installed. What I am looking for is non-plugin ways to harden wordpress during a fresh install.

    Thanks for the post!

  4. Thank you so so much! This one line that you mentioned: “The codex specifies that it should be added before the line that says require_once(ABSPATH.’wp-settings.php’);.” saved my day!

Participate