Introduction

The “WordPress upload directory isn’t writable” error occurs when WordPress does not have permission to write files to the uploads directory. This commonly happens after installing or updating third-party plugins, changing file ownership, migrating a website, or modifying file permissions.

Without write access, WordPress cannot upload media files, install plugins or themes, or perform updates.


Prerequisites

Before proceeding, ensure you have:

  • SSH or FTP access to the server.
  • Root or sudo access (or access to the hosting control panel).
  • A working WordPress installation.
  • Knowledge of the WordPress installation path (e.g., /var/www/html/wordpress).

Steps

Step 1: Navigate to the WordPress Installation

cd /path/to/wordpress

Example:

cd /var/www/html/wordpress

Step 2: Check the Current Permissions

Verify the permissions of the uploads directory.

ls -ld wp-content/uploads

Example output:

drwxr-xr-x 5 www-data www-data 4096 Jul 29 10:15 uploads

Step 3: Verify Directory Ownership

Ensure the web server user owns the uploads directory.

ls -l wp-content

If ownership is incorrect, update it (example for Apache on Ubuntu/Debian):

sudo chown -R www-data:www-data wp-content/uploads

For CentOS/RHEL:

sudo chown -R apache:apache wp-content/uploads

Step 4: Set Recommended Permissions

Set secure directory permissions:

find wp-content/uploads -type d -exec chmod 755 {} \;

Set file permissions:

find wp-content/uploads -type f -exec chmod 644 {} \;

These permissions are recommended for most WordPress installations.


Step 5: Verify Upload Functionality

  1. Log in to the WordPress Admin Dashboard.
  2. Navigate to Media → Add New.
  3. Upload a test image or document.
  4. Confirm the upload completes successfully.

Temporary Workaround (Not Recommended)

If a third-party plugin specifically requires broader permissions and you need to test functionality, you can temporarily set the uploads directory to 777.

chmod -R 777 wp-content/uploads

Warning: Permission 777 grants read, write, and execute permissions to all users on the system, creating a significant security risk. It should only be used temporarily for troubleshooting and reverted immediately after testing.

Restore secure permissions afterward:

find wp-content/uploads -type d -exec chmod 755 {} \;
find wp-content/uploads -type f -exec chmod 644 {} \;

Additional Troubleshooting

If the issue persists:

  • Verify the uploads path in Settings → Media.
  • Check available disk space:df -h
  • Check the web server error logs:
    • Apache:tail -f /var/log/apache2/error.log
    • Nginx:tail -f /var/log/nginx/error.log
  • Verify PHP is not restricted by open_basedir.
  • Ensure SELinux (if enabled) is not blocking writes:getenforce

Expected Outcome

After completing these steps:

  • Media uploads work successfully.
  • Plugins and themes can upload required files.
  • WordPress can create directories within wp-content/uploads.
  • No “Upload directory isn’t writable” errors appear.

Conclusion

The “WordPress upload directory isn’t writable” error is typically caused by incorrect ownership or file permissions on the wp-content/uploads directory. In most cases, correcting the directory ownership and applying secure permissions (755 for directories and 644 for files) resolves the issue. While setting permissions to 777 may temporarily bypass the problem, it is not recommended for production environments due to the associated security risks. Regularly verifying permissions and ownership helps maintain both functionality and security for your WordPress installation.

Leave a Reply