At times, you may need to replace WordPress core files.
In that case:
- First, take a backup of your website so that you may revert back to the website if anything goes wrong. We are going to remove almost all the WordPress files just without the main files of a WordPress website, those that we are keeping are: “wp_content” folder and “wp_config.php” file.
2. Before replacing, check the WordPress version. Because if WordPress is an older version and if you replace it with a newer version, then the website may have a different problem other than the problem that you are currently facing.
3. To check the version, log in to your cPanel then go to “File Manager” and click on the “wp_includes” folder from “public_html” file.
4. On the new page, you will see some folders and files. Now scroll down at the bottom of this page and click on “version.php” then click on the “view” button at the top of this page.
5. Now from the new page, you will find the WordPress version.
6. Then you will need to download a new WordPress to replace it. You can download a New or Old version from here:
7. The website will work only if you leave the “wp_content” folder and “wp_config.php” files and replace the rest. For this, “wp_content” and “wp_conflig.php” should be left and the rest should be deleted.
8. Now extract the previously downloaded WordPress file and delete the two files “wp_content” and “wp_conflig.php” from there and compress the rest of those files on your computer. After that, you have to upload that compressed (zip) file to cPanel and “Extract” it in the “public_html” file.
9. Finally, after replacing the core files check the “wp_content” folder to see if there are any cache files. If there are cache files, you may need to “Delete” those files too.
After replacing the core file in this way, now you should check to see if the problem is solved.