How to Define the Upload Path in WordPress

Most of the time, you don't have to worry about the upload path in WordPress. It's just handled automatically with a fallback.

A plugin on a site I was working on had a problem with wp_upload_dir(), which is supposed to fetch the location of the uploads. It resulted in the error you see in the picture above.

Error: Your upload path is not valid or does not exist: C:\xampp\htdocs\abf/C:/xampp/htdocs/abf/wp-content/uploads

Thankfully, the solution was very simple.

How to define the upload path in WordPress:

  1. Open wp_config.php in your preferred text editor
  2. Add this line below the WP_DEBUG line:
    define('UPLOADS', 'wp-content/uploads');
  3. Save wp_config.php

If you have a custom upload folder, change 'wp-content/uploads' to that location.

You can also use this function to set a custom directory for uploading your images and other WordPress media files.

Mike Haydon

Thanks for checking out my WordPress and coding tutorials. If you've found these tutorials useful, why not consider supporting my work?

Buy me a coffee

1 thought on “How to Define the Upload Path in WordPress”

Leave a Comment