WordPress Replace Core Files

There are many reasons why you might need to replace core files of your WordPress installation such as a broken set of core files, needing to rollback an update, a manual WordPress version update, replacing compromised files, and so on.  Here is how you can do that.

First download the version you want from here https://wordpress.org/download/release-archive/

For the latest version https://wordpress.org/latest.zip

Access the files for your WordPress installation either via FTP

or through a File Manager.

The most thorough way to replace the core is to first remove the old core, I always recommend saving the old core into a different folder and making sure the update worked before removing it, just in case.  These are the files that you should remove.  It’s important not to replace the wp-config, htaccess, or wp-content.  The wp-config.php file is where your database connection string is housed, the wp-content folder contains your themes, plugins, and media files, and the .htaccess is where your permalink, browser caching, additional redirects and other site enhancements and customization are set.

Removing old core files

Then upload and unpack the zip file from the WordPress.org site and move all the files except wp-content.

New core files

Documentation: WordPress Codex