Change WordPress Media Upload Directory - WordPress Tips, Tricks Every Serious Blogger Must Know

 


Change WordPress Media Upload Directory - WordPress Tips, Tricks Every Serious Blogger Must Know


Change WordPress Media Upload Directory


If you want to change your media upload directory, you can easily do that by adding a line of code to your wp-config.php file.

For example, let’s say you want to change your upload directory to a folder called “media” located in the WordPress’s root installation directory, we’ll add this code right after require_once( ABSPATH . 'wp-settings.php' ); in the wp-config.php file:

define('UPLOADS', 'media');

From now on, all media files you upload will now go to the “media” folder.

NOTE: It’s advisable to do this on a freshly installed WordPress site. However, you can still do this on an already existing one, provided you know what you’re doing. This is because your old media files won’t magically move to the new folder.

As a result, when you do this on an existing WordPress installation, while your old images will still work properly in your posts/pages, they won’t appear properly in the media library. To fix this, you will have to move your old media files to the new directory and then update your database to reflect these changes, but that’s a topic for another article.

Previous Post Next Post