Basic WordPress Error De-Bugging

It’s a bit of a shock to me how many “developers” these days don’t know what to do when something goes wrong on their WordPress website.

I’ve seen many people ask on many forums saying “My site is broken, help!”. The replies from people on those forums are around 10% good, 30% useful, 50% not useful and around 20% plain wrong. The problem is that the vast majority of people these days that consider themselves to be WordPress developers don’t actually know anything about the codebase – they just know how to install page-builder plugins and commercial “everything-in-one” themes.

What are the main WordPress problems?

The main problems that I’ve seen in the past all come from people that have updated their site and had an outdated plugin or theme throw an error because it’s not compatible with the latest release. This can also happen when the hosting servers PHP version is updated and can give the same result.

How can I find out what the error is?

There’s a few ways to find what the errors on your site actually are. Of course every good site will not display error messages publicly (if yours does, find out why and change that now!).

Firstly, most servers keep a log of errors, so you can log into your hosting account administration area (check with your hosting company) and check for an error log there. These logs will show you what went wrong and what the actual error message is.

There’s also a lot of servers, mainly cPanel from what I’ve seen, that record errors in an ‘error_log’ file in your sites directory structure. While these can be useful they also need you to use FTP to get the file, or use a file management tool through your hosting account.

For WordPress, you can also update the wp-config.php file on the site to allow it to show and log errors. In this file, change these values:

define ('WP_DEBUG', true);
define ('WP_DEBUG_LOG', true);

That will display the error messages publicly as well as logging the error messages to a log file, so you can see what they are. Be very careful with the value for WP_DEBUG as you want that to be set as ‘true’ for the shortest possible time because while it lets you see the error messages, it also lets everyone else visiting the site to see the error messages as well.

How can I fix the error?

This is the million-dollar question! The problem is that how WordPress errors are fixed depends on what the problem actually is.

Most times you’ll be able to track down just where the error is in the log file entry. This sort of line will show where the error is in the file system:

[11-Jan-2022 04:33:47 UTC] PHP Parse error: syntax error, unexpected 'echo' (T_ECHO), expecting function (T_FUNCTION) or const (T_CONST) in /home/website/public_html/wp-content/themes/my-theme/library/setup.php on line 25

In that example, the error is in line 25 of the file. You can check that file to see if anything quickly stands out as wrong.

There’s more to it then just that and fixing the problems that can from WordPress may be beyond what you can do. In that case you should find a professional service that can help you to debug and fix your WordPress site. I’d personally recommend 7-90 Systems (spoiler: that’s my company).

Leave a Reply

Your email address will not be published.