Fix the WordPress upload path error after a migration

"Unable to create directory" after a site move usually means WordPress still holds the old host's upload path. How to read the error and fix it.

On this page
  1. Read the path in the error
  2. Where the old path comes from
  3. Fix 1: clear the field in Settings > Media
  4. Fix 2: set UPLOADS in wp-config.php
  5. Fix 3: when it really is permissions
  6. Don’t move the path on a working site

The media library error reads like a permissions problem:

Code
Unable to create directory uploads/2026/10. Is its parent directory writable by the server?

After a site move, it often isn’t one. The database still holds the old server’s folder path, and WordPress keeps trying to save every new upload there. The folder doesn’t exist on the new host, so every upload fails.

I went through the upload code in WordPress core and reproduced both versions of this on a test site running WordPress 7.1.4. The path inside the message tells you which version you have.

Read the path in the error

WordPress builds this message in wp_upload_dir(), in wp-includes/functions.php, when it can’t create the month folder for a new upload. It never prints the full server path. When the uploads folder sits inside your WordPress folder, you see the path from there. When it sits anywhere else, you only see the last folder name and the date.

So the same error comes in two shapes:

  • wp-content/uploads/2026/10 means WordPress is using the normal folder. The folder is there, and the server can’t write to it.
  • uploads/2026/10, with no wp-content, means WordPress is pointed at a folder outside your site. That’s a stored upload path.

On my test site, I stored a path WordPress couldn’t create and uploaded an image through the media library. The upload failed with this same message, and the path in it was the folder WordPress couldn’t create.

Where the old path comes from

WordPress keeps the upload location in two options in wp_options. upload_path is the folder and upload_url_path is the URL. On a fresh install both are empty, and WordPress uses wp-content/uploads.

If either one was ever set on the old site, it moves with the database. A full server path like /home/oldhost/public_html/wp-content/uploads is used exactly as stored. On the new host, PHP usually isn’t allowed to create /home/oldhost, so uploads stop.

There’s a quieter version of the same bug. When the old folder can be created, the upload works, but the file goes into that folder while its URL still points at wp-content/uploads. On my test site the upload succeeded and the new image URL returned a 404.

A relative path breaks things the other way. With upload_path set to public_html/wp-content/uploads, WordPress builds the folder and the URL from that value. Every image already in the media library got a new URL under /public_html/, and all of them broke at once.

If you have WP-CLI, you can check the value without changing anything:

Shell
wp option get upload_path

An empty line means the default.

Fix 1: clear the field in Settings > Media

You’ll read that WordPress removed the upload path setting in version 3.5. That’s only half true.

The 2012 change hides the “Uploading Files” fields while both options are at their defaults. As soon as upload_path holds anything other than wp-content/uploads, or upload_url_path holds anything at all, Settings > Media shows them again.

The check is in wp-admin/options-media.php, and it applies to single sites only. Multisite never shows these fields.

So on a site with this bug, the field is waiting for you:

  1. Go to Settings > Media.
  2. Under Uploading Files, empty “Store uploads in this folder”.
  3. Empty “Full URL path to files” too, unless you serve media from another domain on purpose.
  4. Click Save Changes.

On my test site, saving the empty fields set upload_path back to an empty string. The Uploading Files fields disappeared again, and the next upload went to wp-content/uploads.

Fix 2: set UPLOADS in wp-config.php

If you’d rather pin the folder in code, add this to wp-config.php, above the /* That's all, stop editing! Happy publishing. */ line:

PHP
define( 'UPLOADS', 'wp-content/uploads' );

The path is relative to your WordPress folder, with no leading slash. WordPress adds it to the WordPress folder for the uploads folder and to the site URL for the uploads URL. It wins over whatever upload_path holds. With the old path still stored and the constant defined, my test site saved uploads to the right folder again.

Two cases need a different value. If your wp-content folder was moved or renamed with WP_CONTENT_DIR, put that folder’s path here instead. And on an old multisite network that still uses ms-files rewriting, WordPress treats UPLOADS differently, so test before you rely on it.

I’d still use Fix 1. The constant covers the stored value up instead of fixing it. Settings > Media keeps showing the old path, and the next person who opens it will wonder which one is true.

Fix 3: when it really is permissions

If the error shows wp-content/uploads/..., the path is fine. The web server can’t write to the folder.

The WordPress guide to changing file permissions uses 755 for folders and says the uploads folder may need it. With SSH access, check the folder and set it:

Shell
ls -ld wp-content/uploads
chmod 755 wp-content/uploads

If the folder belongs to a different user than the one PHP runs as, chmod won’t be enough. That one is a question for your host.

Don’t move the path on a working site

Everything above is for a site where uploads are already broken. On a working site with years of media, changing the path splits the library. New files go to the new folder, the old ones stay behind, and their URLs change with the setting.

If you really need to move the uploads folder, move the files first, then change the path, then run a search and replace on the database for the old image URLs.

If the migration never got this far because the backup was too big to import, that’s a different wall. I covered it in how to increase the All-in-One WP Migration upload limit, and you can also exclude folders from the export to make the file smaller.

Did this answer your question?

If not, tell me what you were looking for. Your question might be my next post.

What were you looking for?

Shameem Reza

Shameem Reza Happiness Engineer at Automattic

I fix WooCommerce problems for a living and review plugins for WordPress.org. Every fix here is tested on a clean site first.

No comments yet. Ask the first question.

No account needed. Comments appear after a quick check.