Before WordPress version three.5, WordPress provides settings under Media that allow publishers to alter the proper noun and location of the folder where WordPress stores all media files, such as images, videos, audios, PDF documents and etc., that are uploaded through WordPress built-in uploader.

Past default, all media files and documents uploaded through WordPress are saved in ./wp-content/uploads directory. As such, when you embed a media on web page, the URL of media ever has "uploads" every bit part of it. You may non prefer the name "uploads", where "images", "data", or even "files" may be more meaningful. But with the removal of options to set custom folder to store uploads, you need a little trick to workaround the limitation.

This tutorial shows you how to change the default media uploads location in WordPress.

Option 1: Enable the "Store uploads in this binder" and "Full URL path to files" in WordPress settings for Media

The simplest way to modify the media upload storing folder is to bring back the option to change media upload path in Settings, and the easiest way to practise and then is past installing Upload Url and Path Enabler plugin. Despite not updating for several years, the plugin is still working fine. After activating, information technology volition bring back the 2 settings in Settings -> Media that allow publishers to change media upload path, i.e. changing the name of uploads binder.

Change WordPress Media Upload Path and URL

The first pick Store uploads in this folder specifies where is the directory that WordPress uploader will shop the media and files. You can input a complete full absolute path to the new binder (which is useful if you lot're using CDN or subdomain to host static images and files), or relative path to WordPress root directory (without leading slash).

If the custom binder location which you lot set to store uploads past WordPress is likewise complicated and not relative to WordPress installation directory, especially when using CDN or sub-domain, and WordPress cannot determines the right and valid URL to the content, y'all need to specify the Full URL path to files setting too. This where you tell WordPress how to construct the file's URL, and it should be a valid accessible URL that when appends with file names, will point to the files. For example, https://cdn.techjourney.internet/media.

You can deactivate the plugin afterwards you lot have set the settings. WordPress will ever brandish the settings one time any custom value for media uploads path or URL is set in the database.

Option 2: Ascertain UPLOADS constant in wp-config.php

Edit the wp-config.php file located in the root directory of the WordPress installation, and then add the post-obit lawmaking right earlier the line of /* That's all, stop editing! Happy blogging. */:

define('UPLOADS', 'files');

Above example will make "files" folder as the place to store all WordPress uploads, and the folder is located in WordPress installation binder, outside of wp-content.

In instance you lot just desire to change the name of "uploads" folder, yous can define the constant as:

define( 'UPLOADS', 'wp-content/' . 'custom_uploads_name' );

Rename custom_uploads_name to any folder proper name you prefer. And all media files will be uploaded to the binder with the new proper noun.

Once you change the uploads folder path, the URL of the media files will too be changed accordingly. WordPress should handle the new uploads automatically. However if you move the location of erstwhile media files manually, you need to supplant the URL of onetime media files in database or add a redirect.

Option three: Add upload_path and upload_url_path values directly in database

The uploads folder path and URL is defined in database past ii fields in wp_options table, namely upload_path and upload_url_path. Once any of the options is set in the database, the options automatically announced in Settings -> Media folio too.

If y'all have WP-CLI installed, you can quickly add together the options to database with the following commands:

$ wp option set upload_path files $ wp option set upload_url_path https://www.case.com/files

Otherwise, yous tin add straight in database with tools such as phpMyAdmin or mySQL client.