Before WordPress version three.5, WordPress provides settings under Media that allow publishers to alter the proper name 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 born uploader.

Past default, all media files and documents uploaded through WordPress are saved in ./wp-content/uploads directory. Equally such, when you embed a media on web page, the URL of media always has "uploads" as function of it. Y'all may not prefer the name "uploads", where "images", "information", or even "files" may be more meaningful. But with the removal of options to set up custom folder to shop 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 "Shop uploads in this folder" and "Full URL path to files" in WordPress settings for Media

The simplest mode to modify the media upload storing binder is to bring back the pick to change media upload path in Settings, and the easiest fashion to do then is by installing Upload Url and Path Enabler plugin. Despite not updating for several years, the plugin is still working fine. After activating, it volition bring back the 2 settings in Settings -> Media that allow publishers to alter media upload path, i.eastward. irresolute the name of uploads folder.

Change WordPress Media Upload Path and URL

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

If the custom folder location which you gear up to store uploads past WordPress is too complicated and not relative to WordPress installation directory, especially when using CDN or sub-domain, and WordPress cannot determines the correct and valid URL to the content, you demand to specify the Full URL path to files setting too. This where you tell WordPress how to construct the file'due south URL, and information technology should exist a valid accessible URL that when appends with file names, volition point to the files. For example, https://cdn.techjourney.net/media.

You tin can conciliate the plugin later you take set the settings. WordPress will always brandish the settings once any custom value for media uploads path or URL is set in the database.

Pick 2: Define 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 code right before the line of /* That's all, end editing! Happy blogging. */:

ascertain('UPLOADS', 'files');

Above case will brand "files" folder every bit the place to store all WordPress uploads, and the folder is located in WordPress installation folder, exterior of wp-content.

In case yous simply want to alter the name of "uploads" folder, you lot can define the constant as:

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

Rename custom_uploads_name to any folder proper name y'all prefer. And all media files volition be uploaded to the folder with the new name.

Once you change the uploads binder path, the URL of the media files will also be changed accordingly. WordPress should handle the new uploads automatically. However if you motility the location of erstwhile media files manually, you need to supercede the URL of erstwhile media files in database or add together a redirect.

Option 3: Add upload_path and upload_url_path values directly in database

The uploads folder path and URL is defined in database by two 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 appear in Settings -> Media page too.

If yous take WP-CLI installed, you lot tin quickly add the options to database with the post-obit commands:

$ wp option set upload_path files $ wp option fix upload_url_path https://world wide web.instance.com/files

Otherwise, y'all can add together directly in database with tools such as phpMyAdmin or mySQL client.