Wordpress Change Upload Folder From Custom to Default
Before WordPress version iii.5, WordPress provides settings under Media that allow publishers to change the 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 built-in uploader.
By 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 part of information technology. You may not prefer the name "uploads", where "images", "information", or even "files" may exist more meaningful. Merely with the removal of options to set custom binder to store uploads, you need a piffling trick to workaround the limitation.
This tutorial shows you how to alter the default media uploads location in WordPress.
Option one: Enable the "Store uploads in this folder" and "Full URL path to files" in WordPress settings for Media
The simplest way to change the media upload storing folder is to bring dorsum the option to change media upload path in Settings, and the easiest way to practice so is by installing Upload Url and Path Enabler plugin. Despite non updating for several years, the plugin is still working fine. Afterwards activating, it will bring dorsum the 2 settings in Settings -> Media that permit publishers to change media upload path, i.e. changing the name of uploads folder.
The first pick Store uploads in this binder specifies where is the directory that WordPress uploader will store the media and files. Y'all tin input a complete full absolute path to the new folder (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 folder location which you fix to store uploads by WordPress is too complicated and non relative to WordPress installation directory, especially when using CDN or sub-domain, and WordPress cannot determines the right and valid URL to the content, yous need to specify the Total URL path to files setting also. This where you tell WordPress how to construct the file'south URL, and information technology should be a valid attainable URL that when appends with file names, will point to the files. For case, https://cdn.techjourney.net/media.
Option 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 following code right earlier the line of /* That's all, end editing! Happy blogging. */:
define('UPLOADS', 'files'); Above example will make "files" folder as the identify to shop all WordPress uploads, and the binder is located in WordPress installation folder, outside of wp-content.
In case you lot just desire to change the proper noun of "uploads" folder, y'all can ascertain the constant as:
ascertain( 'UPLOADS', 'wp-content/' . 'custom_uploads_name' );
Rename custom_uploads_name to whatsoever folder proper noun you prefer. And all media files will exist uploaded to the folder with the new proper noun.
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 tabular array, 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 you have WP-CLI installed, y'all can quickly add the options to database with the following commands:
$ wp option set upload_path files $ wp choice fix upload_url_path https://www.case.com/files
Otherwise, yous tin can add directly in database with tools such every bit phpMyAdmin or mySQL client.
Source: https://techjourney.net/how-to-change-wordpress-media-uploads-path-url-folder-location/
Post a Comment for "Wordpress Change Upload Folder From Custom to Default"