Home » wp-content » Unable to Create Directory wp-content/uploads: WordPress Fix

Unable to Create Directory wp-content/uploads: WordPress Fix

You drop an image into the Media Library and WordPress refuses it with this message:

Unable to create directory wp-content/uploads/2026/12. Is its parent directory writable by the server?

The same error shows up in the block editor, on WooCommerce product images and in plugins that import files. It usually starts right after a migration, a host change or a server user change, or on the first upload of a new month, when WordPress has to create a fresh year/month folder.

The fix is almost always one of three things: a wrong upload path saved in the database, wrong ownership or permissions on wp-content/uploads, or a server limit like a full disk. I go through them in that order below.


The message comes from wp_upload_dir() in wp-includes/functions.php. It works out the uploads folder, adds the /YYYY/MM subfolder if “Organize my uploads into month- and year-based folders” is on, and calls wp_mkdir_p(). If that returns false, you get the error.

The uploads folder comes from three places, in this order of priority:

  • the UPLOADS constant in wp-config.php, used as ABSPATH . UPLOADS
  • the upload_path option in the wp_options table
  • the default, WP_CONTENT_DIR . '/uploads'

The path in the message is a hint. When the uploads folder is inside your WordPress root, WordPress strips the root and you see wp-content/uploads/2026/12. When the folder is somewhere else, it only shows the last folder name plus the subfolder, like uploads/2026/12.

So if your message says uploads/2026/12 without wp-content/ and you never moved the uploads folder on purpose, suspect a stale path from the old server. If it shows the normal wp-content/uploads/... path, the path setting is probably fine and the permissions step is where you will find the cause.

💡 On Bedrock-style installs where WP_CONTENT_DIR lives outside the WordPress core folder, the short uploads/... form is normal and does not mean the path is wrong.


Step 2 can change rows in wp_options, so take a database export before you touch anything:

wp db export before-uploads-fix.sql

WP-CLI prints a “Success: Exported to” line with the file name. Move that file out of the public web root when you are done.

Check what WordPress has stored and what it actually resolves:

wp option get upload_path
wp option get upload_url_path
wp eval 'print_r( wp_upload_dir() );'
grep -n "UPLOADS" wp-config.php

On a standard install both options are empty (or upload_path is wp-content/uploads), and the basedir line from wp_upload_dir() points into your current site folder. If you see an absolute path from the old host, something like /home/olduser/public_html/wp-content/uploads, that is your bug. PHP cannot create folders in a home directory that does not exist on this server.

Empty both options so WordPress goes back to the default:

wp option update upload_path ''
wp option update upload_url_path ''

Without WP-CLI, run the same thing in phpMyAdmin:

UPDATE wp_options
SET option_value = ''
WHERE option_name IN ('upload_path', 'upload_url_path');

💡 Replace wp_ with your table prefix from wp-config.php.

If grep found an UPLOADS line, remember that WordPress puts ABSPATH in front of it. It has to be a path relative to the WordPress root, without a leading slash:

/* Custom uploads folder, relative to the WordPress root. */
define( 'UPLOADS', 'wp-content/media' );
unable to create directory wp content uploads wp config 1 - Unable to Create Directory wp-content/uploads: WordPress Fix
Where it goes in wp-config.php: above the “That’s all, stop editing!” line

An absolute value like /var/www/site/media gets glued onto ABSPATH and turns into a path that does not exist. If you do not need a custom folder, delete the line.

Old image URLs in post content are a separate problem from this error. If they still point to a custom folder after you switch back, see how to change image URLs in the WordPress database.

If the path is correct, PHP is simply not allowed to write there. Compare the owner of the folders with the user PHP runs as:

ls -ld wp-content wp-content/uploads wp-content/uploads/2026
ps -eo user,comm | grep -E 'php|httpd|apache2' | sort -u

The first command shows the owner and mode of each folder. The second lists the users running PHP-FPM or Apache. If the uploads folder belongs to root or to a deploy user while PHP runs as www-data or your site user, PHP cannot create 2026/12 inside it.

See also  Plugins Auto-Updates Column Missing in WordPress? Find the Cause

Fix the ownership and reset permissions to the values from the official WordPress file permissions guide (755 for folders, 644 for files). Replace siteuser:siteuser with the user and group PHP runs as:

sudo chown -R siteuser:siteuser wp-content/uploads
find wp-content/uploads -type d -exec chmod 755 {} \;
find wp-content/uploads -type f -exec chmod 644 {} \;

Do not “fix” this with 777. The same guide says no directory should ever get 777, upload folders included. If your files must stay owned by a deploy user, put PHP in that user’s group and use 775 on folders instead.

Getting the parent folder right matters for later months too. wp_mkdir_p() copies the permission bits of the nearest existing parent onto every folder it creates, so a correct uploads folder means 2027/01 will be correct as well.

To test as the web user instead of your shell user, run WP-CLI as that user:

sudo -u www-data wp eval 'print_r( wp_upload_dir() );'

The [error] line should be empty. If it still shows the “Unable to create directory” text, the problem is not ownership, so move on to Step 4.

This is the same ownership mismatch that makes WordPress ask for FTP credentials and makes plugin installs fail with Installation failed: Could not create directory, so fixing it often clears those errors at the same time.

On OpenPanel you can do this without SSH. Open File Manager and use the Fix Permissions button. It makes you the owner of the files under /var/www/html/, sets folders to 775 and files to 664, and lets you limit it to one path such as your site’s wp-content/uploads. In cPanel’s File Manager you can change permissions per item, but ownership problems normally need root, so you end up opening a ticket with your host.

If both the path and the ownership are correct, look at the server itself. A full disk or an exceeded account quota makes mkdir fail exactly like a permission problem:

df -h .
du -sh wp-content/* | sort -h | tail

If the filesystem shows 100% used, free up space first. I covered how to find what fills it in 507 Insufficient Storage on WordPress.

On RHEL, AlmaLinux and Rocky servers with SELinux enforcing, correct Unix permissions are not enough. The web server also needs the right SELinux context on the folder it writes to:

ls -Zd wp-content/uploads
sudo chcon -R -t httpd_sys_rw_content_t wp-content/uploads

Last, if your host sets open_basedir in PHP, the uploads path must sit inside one of the allowed folders. This bites sites where upload_path or UPLOADS points outside the site’s home directory. Check the value in your hosting panel’s PHP settings or in a phpinfo() page, and keep uploads inside the site folder.


Most of these errors come from moves between servers. I would make two checks part of every migration checklist: run wp option get upload_path, and fix ownership on wp-content before the site goes live on the new server. Both take a few seconds.

Deploy files as the same user PHP runs as, or use a shared group. Never leave upload folders owned by root after an rsync or an archive extract made with sudo.

TL;DR: “Unable to create directory wp-content/uploads/… Is its parent directory writable by the server?” means wp_mkdir_p() could not create the upload folder. Empty a stale upload_path or upload_url_path, check the UPLOADS constant, give the PHP user ownership of wp-content/uploads with 755/644 permissions, and check disk space, SELinux and open_basedir if it still fails.

Was this post helpful?

Leave a Comment

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.

Recommended