WordPress Failed to Write File to Disk: How to Fix This
parallax background

WordPress Failed to Write File to Disk: How to Fix This

The Best Wedding WordPress Themes You Can Get
March 8, 2023
Get the Best Travel WordPress Theme from This List
March 9, 2023
The Best Wedding WordPress Themes You Can Get
March 8, 2023
Get the Best Travel WordPress Theme from This List
March 9, 2023
 

Media content is one of the key features of attractive websites. So all WordPress users should know how to avoid errors with media uploads and how to fix them.

The 'WordPress failed to write file to disk' error makes it impossible to upload a file to the Media Library. There are three main sources of this problem covered in this article.

The troubleshooting isn't difficult. This guide is easy to follow even for beginners.

It outlines how to deal with each of the three common causes. But before fixing it, it's important to explain why the error occurs.

Common Sources of the ‘WordPress Failed to Write File to Disk’ Error

 

Understanding the problem is the first step of successful troubleshooting. The solution depends on the cause of the issue.

The error has three common sources:

1. incorrect file permissions

2. no more space in the WordPress temporary directory

3. reaching the disk storage limit.

File permissions are part of security measures in WordPress. They control which users can access a file and what actions they can perform.

Incorrect setup can block WordPress users from reading, running, or modifying files hosted on the account.

The uploads folder permissions may prevent certain users from 'writing' to the disk. This includes uploading new files.

This can be the cause of the 'WordPress failed to write file to disk' error. To check if this is your case, use the Site Health tool:

 

1. Go to the WordPress dashboard menu and click on Tools.

2. Choose Site Health from the list and click on the Info.

3. Go to the last dropdown menu and check the file permissions for the uploads directory. It should be Writable.

If the setting is different, this is the cause of the issue.

Sometimes the source of the error doesn't lie with the file permissions. There's just no more space in the WordPress temporary file directory.

The third common reason why users can't upload files is that they have reached the disk storage limit.

A hosting plan determines how much disk space users have on the webserver. When they run out of space, they can't add any more files and they get the 'WordPress failed to write file to disk' error.

Having identified what's causing the error, follow the instructions below to fix it.

How To Fix the 'WordPress Failed To Write File To Disk' Error

There is a way for users to change the incorrect file permissions. Or they can make more space in the temporary folder.

It's also possible to resolve the problem of exceeding the quota limit. Follow the process below that corresponds with the cause of the error.

How To Fix Incorrect File Permissions

The number one source of the 'Failed to write file to disk' error is incorrect file and folder permissions. File permissions protect websites from unauthorized access and modification that could harm them.

Before a server 'writes' (or uploads) files to any folder, it checks the folder permissions. If the folder permissions prevent 'writing', the web server will block the upload.

The basic rule in WordPress for correct folder and file permissions is 644 for files and 755 for folders. Users can change the incorrect permissions via an FTP client, cPanel, or SSH.

Here are the instructions for each process.

How To Change Folder and File Permissions Via an FTP Client

 

1. Log in to an FTP client, such as FileZilla. Check the hosting account dashboard to find your credentials.

2. Go to the root folder public_html > wp-content.

3. Right-click on the wp-content folder and select File Permissions. The file permissions dialog box will open.

It displays the current settings for Owner permissions, Group permissions, and Public permissions.

4. Enter 755 as the Numeric value.

5. Tick the box 'Recurse into subdirectories'.

6. Select 'Apply to directories only'.

7. Press 'OK'.

The FTP client uses the 755 permissions for all subdirectories in the wp-content folder. So it will change the permissions for the Uploads folder within the wp-content too.

 

Next, set up the individual file permissions inside the wp-content folder. Here are the steps:

1. Locate the wp-content folder and right-click on it.

2. Select File Permissions.

3. This time set the Numeric Value to 644 in the file permissions dialog box.

4. Tick the box ‘Recurse into subdirectories’.

5. This time, select 'Apply to files only'.

6. Press 'OK'.

 

The FTP client uses the 644 permissions for all files within the wp-content folder. This includes Uploads.

This process should remove the 'Failed to write file to disk' error and the upload should be working again.

How To Change Folder And File Permissions In cPanel

1. Open cPanel.

2. Go to the File Manager.

3. Choose the name of the file to modify.

4. Select the option 'Change permissions'.

5. Set up the correct numeric value.

6. Click on 'Change permissions'.

How To Change File Permissions Via SSH

 

1. Go to the WordPress root folder. If your WordPress files are in the public_html folder, execute: cd public_html

2. Set the permissions to 755: chmod 755 wp-content

The wp-content folder’s permission will be set to 755. To set the same permissions to all files and folders inside the wp-content folder, add the -R flag before 755 in the command.

How To Clear the WordPress Temporary Folder

 

WordPress file permissions aren't the only cause of the 'Failed to write file to disk' error. It may be necessary to empty the temporary file directory.

WordPress uses a temporary folder on a webserver to temporarily store the files users upload. From there the files can be moved to the Uploads folder.

But if there is not enough room in the temporary folder, users get the 'Failed to write file to disk' error.

If that's the case, contact the web hosting provider. It's not possible to clear the temporary files directory using FTP.

How To Fix Exceeded Server Storage Space

 

A web host provider usually offers different plans. These allocate a certain amount of storage space to a website on a server.

The maximum storage limit is also called the 'quota limit'.

When users exceed their allocated storage space, they can't upload more files. Instead, they will get the 'WordPress failed to write file to disk' error.

If you think this is the cause of the upload problems, contact the web hosting provider. It may be possible to change plan and get more disc space.

Another option is to free up some storage space by deleting old files that are no longer needed. Do this using FileZilla or cPanel.

FAQ about the WordPress "failed to write file to disk" error

Why am I getting a "failed to write file to disk" error in WordPress?

The "failed to write file to disc" error in WordPress happens when the server can't write or create files because it doesn't have enough permissions, doesn't have enough space on its hard drive, or for some other reason. It can also happen because of conflicts between plugins or themes, wrong file ownership or permissions, or wrong server settings.

What could be causing WordPress to fail to write files to disk?

WordPress might not be able to save files to disc for a number of reasons, such as if the file permissions are wrong, there isn't enough space on the disc, the server isn't set up right, or there are conflicts with themes or plugins. The error could also be caused by malware, viruses, or other problems with security.

How do I fix the "failed to write file to disk" error in WordPress?

To fix the "failed to write file to disc" error in WordPress, you can check your file permissions, add more disc space, look for plugin and theme conflicts, and make sure your server is set up correctly. It's also important to make sure your WordPress core, themes, and plugins are all up-to-date to avoid problems.

Can I prevent the "failed to write file to disk" error from happening in the future?

Yes, you can stop the "failed to write file to disc" error from happening again by making sure your server has enough disc space, regularly checking and adjusting file permissions, using trusted themes and plugins, and keeping your WordPress installation up to date with the latest security patches.

What permissions should I set for my WordPress files and folders to avoid the "failed to write file to disk" error?

To avoid the "failed to write file to disc" error in WordPress, make sure that your files and folders have the right permissions. Folders should have permissions of 755, and files should have permissions of 644. But some plugins might need different permissions, so it's important to check their documentation or contact their support team.

Is there a plugin or tool I can use to diagnose and fix the "failed to write file to disk" error?

Yes, there are a number of plugins and tools that can help diagnose and fix the "failed to write file to disc" error in WordPress. WP-Optimize, WP-DB Manager, and WP-CLI are some of the most popular choices. But you should be careful when using these tools, and you should always make a copy of your site before making any changes.

How can I troubleshoot the "failed to write file to disk" error in WordPress?

To fix the "failed to write file to disc" error in WordPress, check your server's disc space and file permissions, turn off any plugins or themes you just installed, and clear your browser's cache. You can also check out the support forums on WordPress.org or ask a WordPress developer or support team for help.

What impact does the "failed to write file to disk" error have on my WordPress site?

The "failed to write file to disc" error can have a big effect on your WordPress site because it can stop important files, like post draughts or plugin updates, from being made or updated. If it isn't fixed quickly, it can also cause data loss or corruption.

Are there any known conflicts or issues that can cause the "failed to write file to disk" error in WordPress?

Yes, there are known conflicts or problems that can cause the "failed to write file to disc" error in WordPress. These include plugin conflicts, problems with file ownership or permissions, and server misconfigurations. It's important to know about any possible conflicts or problems and to ask for help if you're having trouble.

How can I recover any lost data or files due to the "failed to write file to disk" error in WordPress?

You can try to use backups to get back any lost data or files caused by the "failed to write file to disc" error in WordPress. If you have a backup of your site, you can restore it to a previous version and get back any lost data. If you don't have a backup, you can try to get any lost files or data back with a data recovery tool.

But it's important to remember that recovering lost data can be hard, and it's not always possible to get all of it back. To avoid possible data loss, it's important to have a backup plan in place.

Ending thoughts on fixing the WordPress failed to write file to disk error

Uploading files doesn't always go smoothly. But following the steps outlined in this post should fix the issue.

This article covered the three main reasons why users get the error message.

When uploading fails, it may be necessary to change folder permissions. In other cases, the temporary files directory is full and the web host will have to fix that.

Finally, WordPress can fail to write files to disk when users reach the allocated storage limit on their web hosting server. They can delete some files to free up space or get a new web hosting plan.

If you enjoyed reading this article on WordPress failed to write file to disk error, you should check out this one about WordPress briefly unavailable for scheduled maintenance error.

We also wrote about a few related subjects like failed to open stream error, WordPress post missed schedule, failed to load resource error, WordPress posting to Facebook done automatically, Wordpress mixed content errors, how to reorder pages in WordPress and WordPress updating failed error.

Albert Ślusarczyk
Albert Ślusarczyk
As the co-creator of Be Theme, I am a strong believer in designing with care and patience. I pour my energy, time & knowledge into perfecting the theme for our 260,000+ customers.