How to Change the Default WordPress Uploads Folder

There are many different reasons why users might want to change the default upload directory in WordPress.

In terms of performance, it makes it possible to host images on a subdomain, also making backups more efficient. Changing the directory can also create a different URL structure and organization for media files.

Prior to WordPress 3.5, you could change the upload directory path from the Settings menu in the backend, but this is no longer possible.

In today’s Weekend WordPress Project, I’ll show you how to easily change your default uploads folder.

Media folder
Create a custom media uploads folder for your site.

Change Default Media Folder

Open your wp-config.php file, locoed at the root of your WordPress installation, and add the following snippet:

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

Make sure you add this code before the line:

1
require_once(ABSPATH.’wp-settings.php’);

If the directory doesn’t already exist, WordPress will automatically create it as long as the wp-content folder is writeable. Otherwise you can great the folder yourself via FTP, cPanel etc.

Media folder
Create a custom media folder for your WordPress site.

You can also change the way uploads are organized. If you open your uploads folder you’ll notice that files, by default, are sorted into years. You can change your file organization so that all media files are dumped in the one folder. Go to Settings > Media and uncheck “Organize my uploads into month- and year-based folders.”

Not only will it make your URLs simpler, it will also make it easier to see all your files in one place instead of having to sort through month and year directories.

Comments (3)

  1. Is there a way to do this, but to an alternate domain? For example, let’s say I upload a new photo to a WordPress site at EXAMPLE1.COM, but I want it to upload to a defined directory at EXAMPLE2.COM. Could you do this somehow by providing FTP information somewhere…?

  2. Is it possible to change it to store them – not by month and year – but by numbered or lettered folders? I am moving to wordpress with well over 100,000 images that are stored with about 2000 per folder, and I’d like to keep it that way.

Participate