WordPress Debug Steps

Documentation

Need to send invoices?
Check out my new WordPress plugin HDInvoice
Limited time launch sale

WordPress sites can get complicated. With tens of thousands of different themes, and tens of thousands of plugins available, your site can have lots of different chefs in the kitchen – each adding their own spice code to modify WordPress in some way.

Sometimes, the way these modifications were done, they can cause conflicts. This article will go over ways for you to debug your site to hopefully, at the very least, track down where the issue is originating from.

Enable WP_DEBUG

If you have access to your hosting account and can edit files, the first thing to do is to temporarily enable WP_DEBUG mode. With this enabled, WordPress will be able to spit out some error messages, helping you figure out what the problem is and where it is coming from.

To enable WP_DEBUG you will need to log into your host and find a file wp-config.php, usually located in the same folder that WordPress is installed in (check the public_html folder).

In this file, look for a definition called WP_DEBUG. It should be near the bottom of the file and look like define('WP_DEBUG', false);. All you need to do is change false to true and then save the file.

Now, if you go to the page with the error, you will hopefully see some error messages.

If you are not a coder, these messages will mostly look like gibberish to you, but the real value can be found by taking a look at the filename included in the message.

Example message:

Notice: Trying to get property 'data' of non-object in domain.com/wp-content/plugins/example-plugin/file.php on line 15

You may have no idea what a ‘property’ is or what ‘non-objects’ are, but we can still use the file path to determine that this notice is coming from file.php which is a plugin file for a plugin called example-plugin.

Just note that an error or notice doesn’t always mean that the error generator (the theme or plugin showing the message) is the cause. Sometimes other plugins can change core WordPress behaviour that other plugins rely on.

Finally, just remember to go back and edit wp-config.php again to set WP_DEBUG back to false. You don’t want your site showing error messages to all visitors.

WordPress Debug Steps

If you were able to use the WP_DEBUG method to track down where your errors are coming from, then a good test would be to deactivate the theme or plugin causing the errors to see if the problem is solved. If the issue is solved, then you can contact the authors of the offending theme or plugin and see if they can provide you with support. If not, you may need to consider looking for alternative options that do not have the offending error.

If you are still unable to track down where the error is coming from, then the best course of action is to play the elimination game.

Temporarily Switch Themes

Just to test, temporarily switch themes (preferably to a default WordPress theme such as Twenty-Twenty-Three) and see if the problem persists.

If the issue is no long present, then we know that the theme was the culprit. You will need to either change themes, or contact your theme developer for support.

Plugin Roulette

If the issue persists even after changing themes, then there is a good chance that the issue is related to one of your plugins.

  • Deactivate ALL plugins except the one you are testing and check to see if the issue remains.
  • If plugin works, reactivate each plugin one-by-one, checking again each time until the issue returns.
  • Once the issue returns, you will now know which was the offending plugin.

Contact Your Host

Some issues can be caused by your host, and thus only your host can fix for you. Somewhat common issues are file uploads or resource limits – issues that are usually host related.

For example, if you are having problems uploading files, this can be caused by your hosting account not having the proper PHP Extensions enabled, or the tmp folder (folder where files are temporarily placed before being moved over to your main folder) being full, or even some security measures implemented by your host.

*tangent* ⇾ I recently spent far more time than I’d like to admit debugging a client’s site when I was unable to update a page. I just kept getting a 404 response, and couldn’t for the life of me figure out why.

Turns out that the page had a link to pastebin.com which the host had on an internal blacklist.

When all else fails, it’s always OK to ask your host for support. That’s part of what you pay them for, after all 🙂

Liked this article? Sharing is caring

Leave a reply

👍 😆 😠 😢 😍
Reply