Update WordPress without FTP

This is a common issue whereby the WordPress system can not write to /wp-content folder directly.

Solution

To solve this issue you need to define the FTP details in the wp-config.php file so WordPress will remember it.
Alternatively, you may also provide WordPress with write access to the /wp-content folder by accessing the FTP root file
and changing the folder file permission (chmod) to 775 rather than the default 755 and 644.

There is however an easier way to deal with this; by defining constant, FS_METHOD in the wp-config.php file. This bypasses
WordPress’s recurring prompts, and allows auto-updates of your files to happen. And it takes only 1 line of code to do this. Follow the following steps:

  • Edit wordpress/wp-config.php and add at the end of file:
define('FS_METHOD','direct');

Make sure WordPress root directory are accessible to www-data

sudo chown -R www-data:www-data  /home/pi/wordpress/
sudo systemctl restart apache2