More than 455 million sites use WordPress and honestly, maintaining it wouldn’t always be that straight. We have seen those mind-bending issues on WordPress where it is advised to replace WordPress core files.
Replacing WordPress core files just sounds hard, but it isn’t hard at all. In today’s post we are going to checkout when you should replace WP core files, why hosting providers limit the support and the best steps to replace WordPress core files. Let’s begin 🙂
What does WordPress core file mean?
In layman’s terms, a WordPress core file is a set of files. These set of files provides the environment for WordPress to run smoothly on your hosting. But obviously we are not going to focus on core files in details but how to replace them, to know more about core files, you can check here.
When to consider replacing WP core files?
1) Messed wp-admin page-
You have a WordPress website, and you try to log in to your WordPress, it gives you a blank white page. If you have done basics such as disabling plugins and switching to default theme does not help, then you should consider replacing WordPress core files.
2) Site migrated-
When you have recently migrated the website between hosting providers, and it does not work as expected. What happens is your source hosting provider has different configuration than the one you recently migrated to.
3) Broken images-
With WordPress, it is very common that a broken image is showing in place of actual images. When you have corrected the upload path and all of those basics, then replacing core files is best to go.
4) Site hack situation-
As WordPress is a popular CMS and used by million peoples, it is more prone to be hacked. Hackers are always trying to find a backdoor in your WordPress website. In such sensitive cases where your website is hacked or redirecting, it is just best idea to replace WordPress core files.
Why hosting providers may not help?
Using hosting through hosting providers is like renting a house from a house owner. Think about it this way, they rent you out a room for you to use. Whatever you put inside that room is your responsibility. If your washing machine breaks, you don’t call the landlord to go fix it for you.
Hosting providers may offer services to fix such issues, if you do not wish to opt to those services, you can continue this article.
How to replace WordPress core files?
Enough explaining, assuming that the website is hosted on Linux or Windows environment, keeping cPanel at center. Let’s begin with procedure.
Head over to subdomain section on your hosting and create a Subdomain, call it as you wish. Example – wpcorefilemigrate.domain.com
Whenever it is necessary, ensure to replace your actual domain in place of domain.com. Note- .com, .net, .in are extensions, do replace it with your extension.
Point the subdomain with hosting IP under Domain DNS section. The subdomain you just created should be pinging or propagated to hosting IP before we move to further steps because we will test subdomain on browser. How DNS is managed is dependent on your domain provider, you must contact domain provider if domain and hosting provider are different.
Install a fresh WordPress on the created subdomain. You can search app installer on your control panel of hosting. The top 2 are Installatron and Softcolous.
You may search them to know which one your web hosting has and perform install. Do remember the login credentials of fresh WordPress install.
Goto the directory where files of recently installed WordPress on subdomain resides. Rename the wp-content folder to wp-content.bake and wp-config.php to wp-config.php.bake. You may want to locate the directory by going to Subdomains from cPanel Admin.
To rename, right-click on the file and choose Rename option. Renaming them would disable existing content and config file on a fresh WordPress install. We are making room for actual content and config file to put in place of that.
Head back to original domain which needs core file replacement and copy the wp-content folder and wp-config.php file from there. Paste them where directory of recently installed WordPress. Again, you would want to goto Domain section of your cPanel to locate the main domain directory and subdomain section of cPanel to locate the subdomain directory.
As shared in Step4], this step-5] allows putting the content and configuration of original WordPress host file to the new one. By copying the wp-content folder and config file on a new fresh install, we are checking if everything goes as we expect to see on subdomain.
It is time to change URL on Database from main domain to subdomain we created to verify if replacing WordPress core file has worked.
Head over to PhpMyAdmin section of your hosting and expand the Database of your website. Goto options table and look for Home and Site URL and update with subdomain we created in step-1].
Finally, just load your subdomain on browser and verify if the issue that you had is no longer there. You may want to try login into it and verify everything until you are satisfied. Once determined that the site works as expected on subdomain, follow step-8] if not, follow step-10] directly.
Assuming you have verified, and the site is no longer facing any issues on subdomain, it is time to put all content of subdomain to the main domain directory.
Goto site path of main domain name and create a folder, call it “Old”. Move all content of main domain to this “Old” folder.
Secondly, goto the site path of subdomain and move all content from subdomain to the main domain site path. This way, we are moving the tested subdomain content to main domain.
Finally, goto PhpMyAdmin like in step Step6] and change the home and site URL back to original domain name. Verify the main site now, it should be all set.
In case if Step-7] did not work out for you, which I believe would be less likely to happen. It is time to opt to services that promise to fix code related issue offered by hosting provider or a genuine developer.
We have checked the best way to replace WordPress core files. Just like when a mobile application does not work as expected, we tend to try to uninstall and reinstall the application. The steps we followed are more like uses same methods and has a very safe approach towards content.
If you have got your issue fixed by following these steps, do comment below in comment box. If you have any issues or doubts over the steps, do reach here. Have a hassle-free WordPress Ahead!