How to Change the Default WordPress Uploads Folder

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, located at the root of your WordPress installation, and add the following snippet:

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

Make sure you add this code before the line:

FREE EBOOK
Your step-by-step roadmap to a profitable web dev business. From landing more clients to scaling like crazy.

By downloading this ebook I consent to occasionally receive emails from WPMU DEV.
We keep your email 100% private and do not spam.

FREE EBOOK
Plan, build, and launch your next WP site without a hitch. Our checklist makes the process easy and repeatable.

By downloading this ebook I consent to occasionally receive emails from WPMU DEV.
We keep your email 100% private and do not spam.

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.

Tags: