If you face an error while installing WordPress OR installing new plugins or themes, it may be occurred by temp directory of WordPress used with download, in such case you can follow the solution mentioned below
Step 1: Open the wp-config.php file from the website root folder.
Step 2: Define WP_TEMP_DIR inside the wp-config.php file, follow the below steps to apply the solution.
When you open the wp-config.php file you will notice the below code on the top of the file.
* @package WordPress
*/
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'dbname');
You have to just enter define('WP_TEMP_DIR', ABSPATH . 'wp-content/'); as shown below and save the file.
@package WordPress
*/
define('WP_TEMP_DIR', ABSPATH . 'wp-content/');
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'dbname');
Now you can try to update WordPress or install new plugins and themes.
NOTE: Please make sure that file permission of the wp-content folder is set to read and write so that server will be able to write.