Self-hosted WordPress is the most popular content management systems in the world. However, it will be difficult to manage the websites with WordPress unless you are maintaining them properly. WordPress will throw different types of error and sometimes you will not be able to login to the dashboard with fatal errors on the frontend. Don’t get panic when you get an error and follow this WordPress troubleshooting guide to fix the error and regain access to login page.
Related: WordPress security guide for beginners.
Before You Troubleshoot
Before you read on further, make sure to check the followings when you face an error:
- Remember your last action which could potentially help you to narrow down the issue.
- WordPress will trigger an automated email to the site’s administrator with a link to recovery mode whenever you have fatal errors and not able to login to the site. use this link to login to your admin panel and safely disable plugins or theme.
- Make sure to have a good hosting plan that supports your traffic. If your web hosting company take down your websites, then the only option is to discuss with them. This is not a WordPress related problem that you can look for a solution in this article. In addition, WordPress errors are not related to the CDN errors you see on the browser like from Cloudflare.
- If you manually enable debug mode, make sure to disable after troubleshooting.
- Put your site under maintenance mode if you can login to dashboard.
Now. let us check out other topics in detail.
1. Check PHP Version
PHP is the backbone of WordPress. PHP related errors are fatal in nature that you will not be able to see the site in the frontend. Generally, you will see an error or warning message indicating the PHP code that created the problem. In the below example error, you can find the Redirection plugin that causes the problem after updating to a newer version. However, when you look into details there is a line “/usr/local/php73/pear”. This gives a clue that the PHP version 7.3 is causing the problem as it may not be compatible with the plugin. The reason is that we use SiteGround hosting and 7.3.27 is the default managed PHP version in SiteGround.
Now that we understood the root cause of the error, we have two options – one is to revert back the plugin to earlier version and the second is to update PHP on your server. Unfortunately, the first option is not possible since we can’t login to the dashboard (we will explain how to do this with FTP in next sections). The best and recommended option is to login to your hosting account and update the PHP version to the latest as explained in this article. After changing the PHP version, we could able to regain the dashboard access and the site was also up and working fine.
Remember, WordPress recommends using PHP 8 and you can request your webhosting company to support this requirement. This can potentially help you to avoid problems with PHP errors. In addition, many hosting companies auto update WordPress which can cause the fatal error. You can disable the WordPress auto update to avoid this problem happening without your knowledge.
2. Disable Security and Caching Plugins
Other than PHP fatal errors, there are two major reasons for getting errors in your WordPress site. one is because of the security plugins and the second is due to caching plugins. In these cases, you will not see any fatal errors in the frontend. However, you will see the broken site layout, missing widgets on the page, not able to login to the dashboard and different sort of issues.
- Disable the security plugin and check whether the site is working properly. If you can’t access the dashboard, rename the plugin to a dummy name to deactivate it using FTP. For example, login to your FTP account and go to “/wp-content/plugins/my-caching-plugin”. Simply rename the plugin to something like “/old_my-caching-plugin”.
- Similarly, clear your cache to check the site is working properly. if you have caching on server side, make sure to clear that cache in addition to plugin’s cache.
Deactivating security plugin and clearing the cache will help you to retore your site into working mode in most situations.
3. Disable Plugins Folder
This is the most extreme case, however needed in both the above cases. If you have updated multiple plugins or enabled auto update for plugins, it is difficult to find which plugin is causing the problem. For example, the, PHP fatal error actually happened when we updated Yoast SEO plugin and not the Redirection plugin. In this case, if we rename Redirection plugin folder, WordPress will show another plugin folder in the PHP error.
The best solution here is to rename the entire plugins folder using FTP. After login to your FTP account, go to “/wp-content/plugins/” directory, Rename the “/plugins” folder to something like “/old_plugins”. This will deactivate all the plugins in your site at once. Now, you can check whether the login page is accessible. After logging into your dashboard, you can enable the plugin one by one and troubleshoot the error. This will help you to narrow down the issue to the plugin that causing the error. Remember, you should keep your FTP login in parallel to do this analysis.
Once you located the problematic plugin, in most cases you may need to get in touch with the developer for the help. Alternatively, you can revert the plugin back to earlier version and disable auto update till the time you find the solution.
4. Change to Default Theme
Similar to plugins, your theme update can also cause errors. However, this is relatively easy to resolve if you are using premium WordPress themes.
- Make sure you have the WordPress default theme available on your site. if not, you can download it from WordPress theme directory and upload under “/wp-content/themes/” folder using FTP.
- Now, change your current theme’s name to a dummy name using FTP.
- This will take your site to the fallback theme which is a default WordPress theme.
- Check you can login to the dashboard and access all other sections.
If this works out, then put your site under maintenance mode and revert back your theme to an older working version. Make sure to follow the below guidelines to avoid theme related problems:
- Always keep the latest WordPress default theme on your site in addition to the active theme.
- Disable auto update of themes to avoid errors happening without your knowledge.
- Use premium theme from quality developer who updates the theme frequently to support latest PHP and WordPress versions. Remember, this is very important as we had lots of problem with the Highend theme we use. The developer has no habit of testing the theme in advance for the WordPress and PHP releases. It caused problems like REST API conflict with SG Optimizer plugin, problems with jQuery migrate and PHP deprecated warnings.
- Do not update the theme immediately after a new release. Wait for some time for others to test the theme. Alternatively, you can do the testing in a localhost environment instead of updating on the live site.
5. Delete Cache Files
We have already explained problems with caching plugins. Here we want to mention about the “Drop-ins” plugin that many caching plugins use. Generally, there are two drop-ins used by caching plugins – advanced-cache.php and object-cache.php Memcached. Sometimes you can also see the PHP warning on the frontend due to these files. It happens if you have not deleted the caching plugin properly or using multiple plugins on the same site and both plugins need these drop-ins to work properly.
When you have caching related problems like broken layouts, you can simply backup these files and delete them. In most cases, your caching plugin will regenerate these files and start working properly.
Note: In addition to deleting these files, you also need to delete or rename the “cache” folder available under “/wp-content/” directory.
6. Enable Debug Mode
If you are not able to find the root cause of the problem from backend as well as frontend then use the debugging option.
- Login to your FTP account and navigate to your site’s root directory.
- Locate “wp-config.php” file and open it for editing.
- Add the below line, save the file and reupload it on your server.
define( 'WP_DEBUG', true );
Now, open the site in a browser to see the PHP warning messages appear. You can use this warning message to find a clue and troubleshoot the problem as we explained in the above section. After fixing the problem, make sure to remove the entry from your “wp-config.php” file or change it to false like below so that users will not see any warning messages that can happen later.
define( 'WP_DEBUG', false );
7. Restore Entire Site and Database Files
This is the last option you should consider if you are not able to find the problem and fix it. Most of the hosting companies have daily back as part of the plan and you can simply restore the entire site with single click. If you do not want to restore entire site, you can also choose the folders or DB to restore. However, this depends upon the capacity of your hosting account. This is also the reason you should purchase a quality hosting plan like SiteGround that supports daily backup.
8. Setup Downtime Monitoring
This is a proactive step to monitor your site’s downtime. As mentioned, errors in WordPress can happen due to auto updating of WordPress, theme or plugins. In this case, you should know the site is down and get an email alert. Though WordPress sends a recovery email, you can only this on administrator’s email. We recommend to use custom solutions like Uptime Robot to monitor the downtime and get email alert to multiple emails. This will also help you to check the duration of the downtime and discuss with your developer or host accordingly.
Final Words
It is proud to use WordPress that power more than one third of the websites on the web. However, half of them use managed WordPress.com and not the self-hosted WordPress.org platform. Once you have a fatal error on your site, you will learn how difficult to resolve the issue and understand your hosting company will not help you to resolve WordPress related problems. This is true compared to hosted platforms (like Weebly, Wix or WordPress.com) where you can drop an email and waiting for solution to your footstep. We hope the above troubleshooting guide helps you to understand the basics and troubleshoot your error in correct direction of resolving it.
Leave a Reply
Your email is safe with us.