When updating plugins or themes in WordPress Updates, the update failed with the following error message (if you’re using inline update in Plugins page, you simply get “Update Failed: Plugin update failed” error message):

The update process is starting. This process may take a while on some hosts, so please be patient.
Updating Plugin(1/1)

Downloading update from https://downloads.wordpress.org/plugin…

An error occurred while updating Plugin: Download failed. Failed to write request to temporary file.

All updates have been completed.

WordPress Failed to Write Request To Temporary File

The most immediate cause and reason for the error to happen in WordPress is filesystem running out of disk space. For the context of WordPress failed to write request to temporary file error, it can be caused either by temporary directory has full, physical disk space full or disk space usage has exceeded disk quota set by web host or control panel on virtual server/host or directory level.

When WordPress updates, it requires a temporary storage to place the downloads and other working files. WordPress makes sure of temporary directory folder designated by server’s configuration, which is common to all application software running on the server. The temporary files should be removed and deleted automatically after use, but sometimes it’s not the case, thus the disk space usage by temp files increased over time.

Normally, the temporary directory is set as /tmp, which can be at the root of the volume for system-wide usage, or in the context of web server, at the root of virtual server or virtual host for specific website or web app usage. The location and name of the temp folder may be different for different system and setup, and also depending on which control panel, if any, that you’re using.

Resolution

Depending on the cause of the problem, there are several approaches to fix the issue, as listed below:

  1. Delete the files in the tmp directory to free up the disk space. This method works if there is a disk space quota limit placed on the temporary directory itself (normally in shared hosting) or on server’s filesystem level, and quota has been exceeded.
  2. Increase the disk space quote limit for tmp directory or server’s filesystem level. This method works if there is a disk space quota limit placed on the temporary directory itself or on server’s filesystem level, and quota has been exceeded, and you have control to amend the quota.
  3. If you have limited ability in increasing the disk quota or disk space, and removing all files in temp folder does not resolve the issue, you can use the following directive to manually assign a temporary working directory (which has enough free disk space such as another disk drive or filesystem) for WordPress usage. To do so, edit the wp-config.php and add the following line:
    define('WP_TEMP_DIR', ABSPATH . 'wp-content/tmp/');

    Replace ABSPATH . 'wp-content/tmp/' with full path to temp directory that you want WordPress to use, enclosed in quotation marks. Note that the specified directory must be able to be access by WordPress running on PHP, i.e. access permissions and PHP restrictions must be correct.