This WordPress error happened to me once, here’s a way to fix it, add this in your wp-config.php file, which is located in your installation folder.
define(‘WP_TEMP_DIR’,dirname(_FILE_). ‘/wp-content/temp/’);
Then go to your wp-content directory and create a folder named temp, this should fix this error.
Why does this WordPress error happen?
This happens when there is an incorrect PHP setting in your server, a PHP setting defines a temporary folder which stores temporary data of apps like WordPress. This data is temporarily stored there before being saved to a designed location.
If the first solution doesn’t work, check the directory permissions – if you have access to cPanel – on your wp-content folder. Directory permission should be 755 or -rwxr-xr-x. 755 means read and execute access for everyone and write access for the owner of the file/folder.
If the last solution didn’t work, contact your hosting’s support.