Connect with us

WordPress

How to move your WordPress uploads folder

Before your start posting to WordPress, think about moving your WordPress uploads folder. With one line of code, you can make it happen.

Manage your WordPress uploads folder. Photo: Roman Kraft/Unsplash

One of the first things I do with a new bog is move my WordPress uploads folder.

This is also referred to as your WordPress media library folder or WordPress uploads directory. It’s the folder on your server, automatically created, to hold all images, documents, audio and video uploaded through your blog.

See also: How to start a WordPress blog

Moving it is very easy, but requires a minor code adjustment to your blog’s wp-config.php file.

Rather than have my uploads appear in myblogurl.com/wp-content/uploads/ etc, I’ll use something shorter like ‘media’, or ‘assets’ or ‘files’, and make the links that bit prettier. It also isolates the uploaded files from core WordPress folders in the event you might accidentally overwrite them or have your install hacked.

Move your WordPress uploads folder

Best practice for this is starting with an empty blog i.e. before you’ve started adding media to your WordPress library.

To define a new folder, you will need to edit wp-config.php in your WordPress root directory. Take care to follow notes in the file, putting any edits in before the stop editing comment. If your wp-config.php does not contain comments, you add these lines in before ABSPATH is defined.

If you want to leave your uploads in the wp-content folder, insert this line.

define('uploads', 'wp-content/'.'assets');

In this case your uploads would go to a folder called assets inside wp-content.

If you want to store your uploads folder in the root of your WordPress install (i.e. before wp-content), use this line instead.

define('uploads', ''.'assets');

In this case, your uploads will now be stored at yourdomain.com/assets/.

Your uploads folders can still be separated into month and year by going to Settings > Media from your WordPress Dashboard. Simple.

WordPress media settings

WordPress media settings

Find this guide to moving your WordPress uploads folder useful? Let me know, have your say in the comments below.

Broadcaster and sports writer at KCLR96FM; digital media head with a production eye on theatre, film and video; Read my Irish food blog, Ken On Food.

Click to comment

Got a comment or question? Have your say...

This site uses Akismet to reduce spam. Learn how your comment data is processed.

More in WordPress