Do you want to change the default media upload location in WordPress?
Up until WordPress 3.5 there was a setting that allowed you to change the upload directory path. Now you can change it by adding a code snippet.
In this article, we’ll show you how to change the default media upload location in WordPress.
Why Change the Default Media Upload Location?
By default, WordPress stores all your images and other media files in the /wp-content/uploads/ folder. To keep them structured, your files are normally stored in folders organized by year and month.
An example of a typical media folder name would be:
This works for most websites. However, some users may want more control over where their files are stored.
Having said that, let’s take a look at how to change the default media upload location in WordPress.
Changing the Default Media Upload Location in WordPress
In order to change the default media upload location, you should access your website using FTP software and create the new folder where you wish to store your files.
After that, you need to edit the wp-config.php file located in the root directory of your WordPress installation, and add a code snippet that will change the upload location to that folder.
For example, to change the upload directory to wp-content/files, you will need to place the following code in wp-config.php.
define( 'UPLOADS', 'wp-content/'.'files' );
Or if you want the upload directory to be outside wp-content, like http://www.example.com/files/, then you need to set upload path in wp-config.php like this.
define( 'UPLOADS', ''.'files' );
Once you’ve chosen the location where your media files will be uploaded, you can also choose how they will be organized inside that folder.
Simply visit Settings » Media on your admin dashboard and select whether or not you want uploaded files to be organized in folders by year and month.
If you uncheck the box, then all your uploads would be in the same folder, without any subfolders.
We hope this tutorial helped you learn how to change the default media upload location in WordPress.