Many WordPress users may encounter a situation where the media file upload directory needs to be modified, but the relevant options cannot be found in the settings of the administrator background. In fact, there were settings before the WordPress 3.5 version, but after 3.5, the official removed the relevant option to change the media upload directory in the settings page.
Because not many people use this option, and if it is modified accidentally, it may cause problems on the website, so it was removed. Can the upload directory still be modified? of course, it can. This article will show how to modify the default Media upload location of WordPress.
Default Media Saving in WordPress
WordPress inherently save all media files in the directory called “Upload”. For example, you can see an uploaded image in your site using the following path:
http://www.yoursitename.com/wp-content/uploads/media-file-name.png
In case if you have chosen the option of “Organize my uploads into month- and year-based folders” available under “Settings > Media > Uploading File” then an image file uploaded on September 2020 in your site can be viewed with the URL:
http://www.yoursitename.com/wp-content/uploads/2020/09/media-file-name.png
Instead of wp-content/uploads folder, let’s try to upload the images into a folder called files. First, we need to create a folder.
Now We need to tell WordPress to upload all our files in the new folder called ‘files’. Open the WordPress wp-config.php file, and then add the following code after require_once(ABSPATH.'wp-settings.php');
declaration.
define( 'UPLOADS' , 'files' );
New uploaded files will now be stored in the “files” folder. In addition, you can also choose whether to organize the uploaded content in the form of the year-month directory in “Settings”-“Media”. Hope this article was helpful?
2 Comments