WordPress – How to change upload basedir

By default WordPress uses the /wp-content/uploads/ directory for uploaded files, for example images added to the media library are saved to this directory.

This can be changed by configuring the wp-config.php file for your WordPress installation.

For example, to change the upload directory to /uploads/ you would add the following line to the bottom of wp-config.php (make sure it is AFTER require_once(ABSPATH . ‘wp-settings.php’);)

define( 'UPLOADS', 'uploads' );

NOTES:

  • When specifying the path do not add a leading or trailing slash, e.g. this is WRONG /uploads/
  • Make sure to test this completely with all your plugins that handle uploads. Whilst it may be a standard WordPress configuration third-party plugins may not support it properly.
  • Multi-site WordPress installs – this will only affect the basedir — each individual site is still configured through the network admin settings (for example, into a sites/12/ sub-directory). I also noticed an issue with uploading outside of wp-content where the site slug is incorrectly added to the path. So for multi-site’s try keeping it inside wp-content.