The default Media Path on WordPress is in a directory wp-content/uploads
to stores media files like image, audio, video, flash and etc. on WordPress admin dashboard has no option to change this default media uploads location.
For any reason if you want to change the default directory to your custom folder, here is tutorial demonstrates step by step how to change default Media Upload Directory in WordPress.
Prerequisites
Before starting with this guide, make sure you have permission access to WordPress project root directory
Step 1: Change Upload Directory without Plugin
WordPress allows users to customize the upload folder destination on a file wp-config.php
. First we need to create a folder, for example myupload
, then open the WordPress wp-config.php
file.
Add code define('UPLOADS','files');
after.require_once(ABSPATH.'wp-settings.php');
<?php
/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');
define('UPLOADS', 'myupload');
?>
Troubleshooting
The problem here, which should be obvious, is that ABSPATH != WP_CONTENT_DIR
every time. If you have WordPress installed in one directory and point to it with WP_SITEURL
, but specify a different directory for wp-content with WP_CONTENT_DIR
. Here is an example WordPress project on localhost
if ( empty( $upload_path ) || 'wp-content/uploads' == $upload_path ) {
update_option( 'upload_path', untrailingslashit( str_replace( 'axfon', 'axfon/myupload', ABSPATH ) ) );
update_option( 'upload_url_path', home_url( '/myupload' ) );
}
Go to or Login into WordPress Admin Dashboard ➝ Settings ➝ Media
Step 2: Change Upload Directory using Plugin
If the above wat make you a little bit complicated you may change it alternatively with WordPress plugin support, most people recommended use this plugin WP Original Media Path, it’s simply specify the url for your upload folder
Go to or Login into WordPress Admin Dashboard ➝ Settings ➝ WP Original Media Path
On the column Full URL path to files, change URL and follow by folder name as your media destination folder
Note:
This Plugin extension is not compatible with WordPress multisite.
If this tutorial could help you, please rate above Star button rating and share to help others find it! Feel free to leave a comment below.