How to troubleshoot common WordPress errors

How to troubleshoot common WordPress errors


With WordPress, you can create and manage a site almost without any technical knowledge. It has many built-in features and templates that let you get started right away. And if you do need to change something, the large user community can help you out.

But as with all things in the world (software included), WordPress is not bulletproof. That means you are responsible for proper functioning, site security, privacy, and maintenance. WordPress’ errors happen, and the consequences are usually not so good. That’s why you need to take care of your site.

AppSec/API Security 2022

WordPress provides you with a lot of tools and “know how” documentation, but at the end of the day, these tools can only do their job if you are familiar with them and know how to use them properly.

This article highlights the most common WordPress errors that users and site owners encounter, and explains how to prevent and fix them. Let’s dive right in.

Getting started with troubleshooting WordPress errors

The best way to avoid and fix common WordPress problems is to know what to look for. When troubleshooting, look for the following signs and symptoms:

  • Site is loading slowly
  • Errors are displayed
  • There is no traffic on the website
  • Website is not loading / displaying correctly

The first step to fixing a problem is to understand what is causing the problem.

For example, if you are trying to load a WordPress site, but it keeps crashing, you should check your web hosting account settings, or deactivate the plugin or theme you have activated or updated last before the website started crashing.

Safety first: backup your WordPress website before making any changes.

It is important to have a separate test server where you can test and view the final results, and always backup your WordPress website (files and database) so it can be restored if the worst happens.

Your WordPress website will let you know about errors that need fixing

There are few ways to view errors in WordPress, depending on the error. You can use the admin dashboard to view some of the errors as WordPress has a very robust back-end error reporting system. You can access this by navigating to Tools > Site Health in the WordPress menu, as shown in the below screenshot.

WordPress Site Health

Your WordPress website will notify you of issues before they become problems. For example, if a plugin or theme crashes, or generates an error, you can see it here. The website will also send you an email.

Basically, the system is designed to help you avoid the most common WordPress problems, and to help you track down any problems you encounter.

What is a WordPress error?

In this case, an error means an issue with your website, a plugin, theme or custom software that you might be running on your website.

It’s also possible that an error is being caused because your site has a malware infection or a browser plugin that you are using on your browser is not compatible with your WordPress’ website setup.

What is a fatal error in WordPress?

A fatal error means that your WordPress site is no longer functioning properly. Fatal errors are more serious than other types of errors, as they can mean that your site might not load at all. It could also be a sign of a hacked WordPress website. However, it is important that you address these issues immediately, without waiting.

How to fix the common WordPress errors with these general solutions

Before you start troubleshooting an error or problem in detail, there are a certain number of simple checks that you can do to eliminate the most common causes. You do not necessarily need to go through all the below steps. You should make a change or run a test, and check the website to see if the latest change you’ve made fixes the issue. If not, proceed to the next one.

  • First start by clearing the WordPress cache, Browser Cache, Hosting’s cache, DNS cache.
  • If your site is still not working, manually deactivate all the plugins installed on your site.
  • Switch to a default WordPress Theme.
  • Refresh the Permalinks (depending on the type of issue that you have).
  • Backup and delete the .htaccess file (note that some plugins and themes write or update the .htaccess file).
  • Check if your wp-config.php has the right database connection details, namely the database’s name, username, password and host. If any of this information is not correct, WordPress can’t communicate with the database to store and retrieve data.
  • Use the WordPress repair tool (WordPress reinstallation)
  • Scan your website for malware and clean them if anything is found. A provider like Virusdie will automatically clean up and protect your sites in seconds.
  • Enable the WordPress debug logs and reproduce the issue to generate some logs for analysis.
  • If all of the above fail, and you are still unable to recover your website, at this stage the best thing to do is to contact your hosting provider.

The most common WordPress errors (how to fix them)

The below mistakes are cited by most WordPress users as the most common reasons for errors on their websites. Let us go through each of them and see how to troubleshoot them.

1. White Screen of Death” (WSoD)

When this happens, you’ll notice it straight away because when you try to access your website, all you see is a white screen. To troubleshoot the White Screen of Death:

Step 1: disable all plugins by renaming the plugin directories (plugins are installed in the /wp-content/plugins directory on the website).

Step 2: check your website

Step 3: if your website is working, it means that a plugin(s) is the cause of the problem. Start activating the plugins one by one until your website stops working again. This allows you to find the “culprit” plugin responsible for the issues on your website

Step 4: The issue might also be a compatibility issue between the plugin and a theme, and not specifically a “broken plugin”. Therefore, you should also try a new WordPress theme, or a default WordPress theme to see if the issue is an incompatibility issue with the theme.

Step 5: Use the Site Health section to identify any possible errors.

2. Error establishing database connection

WordPress reports this error when the WordPress web application cannot connect to the database.

Step 1: Check if your wp-config.php has the right database connection details, mainly the database’s name, username, password and host. If any of the information is not correct, WordPress can’t communicate with the database to store and retrieve data. You can check if the information is valid by trying to log in to the SQL server with the credentials from the wp-config.php file via phpMyAdmin, or any other database admin tool your hosting provider uses.

Step 2: If the connection still fails, it could also be a problem with the SQL server itself, or database permissions, so you should look into those. If you are on a managed hosting account, contact the support of your web hosting.

3. 404-Not Found HTTP error

An HTTP 404 error basically means that the resource you requested, in this case a web page, cannot be found. This can either be caused by a broken link, or the page you are linking to has been deleted, or the URL has been changed. You can delete those broken links from your website, or update it with the working links.

If the page exists, then most probably it is a problem with the WordPress permalinks. In this case;

Step 1: Go to Settings > Permalinks, and click twice on the Save Changes button. Your permalinks settings will be updated, and your rewrite rules flushed.

Step 2: If you are using permalinks, confirm that the below code is in your .htaccess file:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

4. Internal Server Error (HTTP error code 500)

An internal server error is caused when something in the web application (i.e. the combination of WordPress and the plugins and theme) is causing something at server level to crash, or the web server can’t “process” the response received back from the web application.

To troubleshoot such issues:

Step 1: Check and confirm that everything is correct in the .htaccess file.

Step 2: Try the fix for the White Screen of Death, basically by disabling all the plugins.

Step 3: Increase the memory limit of WordPress. The fastest way to do this is to contact your web host. You can increase the WordPress Memory limit by yourself as well, by opening your wp-config.php file, locating the line: define( ‘WP_MEMORY_LIMIT’, ‘??M’ ); and increasing the value to up to 512M.

Step 4: replace the WP-Admin and WP-Includes folders by downloading a copy of WordPress and uploading the files and overwriting the existing ones.

5. Bad gateway (HTTP error code 502) or Gateway timeout (HTTP error code 504)

This problem usually occurs when you are using a CDN solution, or an off-premise WordPress firewall, and it fails to connect to your website to serve the visitor with the HTTP response.

If this happens:

Step 1: Try to refresh the website (CTRL + F5), this could be a temporary connection glitch.

Step 2: Confirm that your website is actually working (most probably, you can access your website directly via an internal URL provided by your web host).

Step 3: Clear the browser cache.

Step 4: Check the CDN or firewall provider’s website, or your web host’s website for announcements, in case they have some outages or have encountered technical issues.

Step 5: If there is nothing obvious, contact all your providers to find out by whom the issue is caused.

6. Ongoing Briefly Unavailable for Scheduled Maintenance error

Usually this happens because for some reason WordPress is stuck in maintenance mode, which is a mode usually WordPress is in when a plugin, theme or the WordPress core is being updated.

To solve this issue:

Step 1: Disable Maintenance Mode by deleting the .maintenance file. This file is saved in the WordPress root folder. This file tells WordPress to put the website into maintenance mode, and it contains the information needed to display the message that will pop up for users.

Step 2: Find out what is causing WordPress to go into maintenance mode. A mistake that typically leads WordPress to be “stuck” in the maintenance mode is how plugins are updated. For example, updating more than just one plugin at a time (i.e. with Bulk updating). By updating multiple plugins at the same time it also becomes harder to discover which plugin is causing this issue after being updated.

7. Auto update (of plugin or theme) failed

Plugins and themes fail to auto update because the files cannot be copied to your website. Very often this problem is caused by wrongly configured WordPress files permissions.

To fix this issue:

Step 1: First off you can manually update the plugin by doing the following:

  • Download the plugin zip file to your computer.
  • Deactivate the plugin you want to upgrade.
  • Extract the files and upload them to your website (if you need help with this, read our guide on how to access your WordPress website files)
  • Activate the plugin.

Step 2: Now that the plugin is updated, check the WordPress file permissions and confirm that the web server user has access to the files so automatic updates do not fail again.

Say goodbye to WordPress errors

Errors are annoying and if not addressed they can scare away potential customers and temporarily cripple your business. Therefore it is very important to address any error you know of on your website.

As we have seen in this article, it is easy to troubleshoot the most common errors. It is also very important to understand what might be causing errors and rectify the problem, so they do not happen again.

Last but not least, it is important to take a proactive approach when it comes to WordPress website management to avoid such problems. For example;

The post How to troubleshoot common WordPress errors appeared first on WP White Security.

*** This is a Security Bloggers Network syndicated blog from WP White Security authored by Ivica Delic. Read the original post at:


Source link