Update WordPress Manually using SSH
This is Step by Step guide to manually update WordPress Core on your Linux server using SSH. You may need it if you have set restrictive file permissions on your server or for any reason.
1. First create a full backup of your website. This is very important in case you make a mistake you can restore it.
cp -R wordpress/* ~/backup/20170208/
2. Download the newest WordPress TAR or ZIP file from wordpress.org in your downloads folder.
wget https://wordpress.org/latest.tar.gz
3. Extract the file.
tar -xzvf latest.tar.gz
4. Deactivate all plugins on your WordPress site.
5. Go to your WordPress root directory and delete your wp-includes and wp-admin directories.
sudo rm -rf wp-includes/ sudo rm -rf wp-admin/
6. Copy the new wp-includes and wp-admin directories from the new version of WordPress to replace the directories you just deleted.
sudo cp -R ~/downloads/wordpress/wp-includes/ ./ sudo cp -R ~/downloads/wordpress/wp-admin/ ./
7. Do NOT delete your existing wp-content folder or any of the files in that directory. Copy files from the wp-content directory in the new version of WordPress to your existing wp-content directory. You will overwrite any existing files with the same name. All of your other files in wp-content will remain in place.
sudo cp -R ~/downloads/wordpress/wp-content/ ./
Caution: If you have customized your themes without renaming them, make sure not to overwrite those files, otherwise you will lose your changes.
8. Copy all files from the root directory of the new version of WordPress. You will overwrite any existing files and new files will also be copied across. Your wp-config.php file will not be affected because WordPress is never distributed with a wp-config.php file.
sudo cp ~/downloads/wordpress/* ./
9. Examine the wp-config-sample.php which is distributed with WordPress to see if any new settings have been added that you may want to use or modify.
10. Visit your main WordPress admin page at /wp-admin/ where you may be asked to sign-in again. You may also have to upgrade your database and will be prompted if this is needed.
12. Re-enable your plugins which you disabled earlier.
13. Delete or refresh cache if your using a caching plugin like WP Super Cache or W3 Total Cache
Your update has been successful and you should be running the newest version of WordPress.
Tip: To avoid losing any custom changes you make to the WordPress core files after you update, you may consider creating your own child theme which will save all your custom coding in a separate directory and therefore not be overwritten when you update to the latest version in the future.