How To Enable WordPress Debugging

Share this post

How To Enable WordPress Debugging (wp-debug).

How to enable WordPress debugging. In this guide I’ll be covering what WordPress debugging is (or wp-debug as it’s sometimes referred to), why you might want to enable WordPress debugging, and how to enable WordPress’ debugging mode.

You can click here find out how to enable WordPress debugging if you’re more interested in finding out how to do this, rather than read the whys and wherefores.

Why you’d need or want to enable wordpress debugging.

WordPress, by default suppresses errors. If your WordPress based site is erroring you’ll see the effect of the error, rather than seeing the error itself.

If your WordPress is erroring while errors are suppressed, you might see pages as not displaying correctly, a white page (WordPress’ white screen of death), or a message saying “there has been a critical error on your website”.

How to enable WordPress debugging

You might see some advice along the lines of “change the theme” or “incrementally disable plugins” but this advice is a bit like going to a pharmacy and munching your way through all the medication thinking “maybe this will make me feel better”. Let’s hope you don’t get as far as the laxatives!

Seriously though, taking this approach to fixing WordPress is random and lengthy. It’s much better to work out whats’ causing the issue with your site to be able to address the issue your site has. WordPress debugging mode allows you to see the error, and the error you see will give you a much better idea of why your site is erroring.

What enabling wordpress debugging does.

Enabling WordPress debugging stops errors from being suppressed. This means that errors will be seen on your site’s pages, specifically the wp-admin page (the page where you log in to your WordPress). Whilst you might think “I don’t want people to see the errors!”:

  1. If you can see an error, you’re more likely to be able to identify and therefore address it’s cause.
  2. You can disable WordPress debugging to suppress errors when you’ve addressed the issue.

How to enable WordPress debugging.

Enabling WordPress debugging is quite straight forward, but you will need access to the hosting account in which your site is held to be able to enable WordPress debugging.

You’d log in to your hosting account, open the file manager, then edit your site’s wp-config.php file (which is usually held in the document root of your site):

Edit wp-config.php

Then locate the line that says:

define(‘WP_DEBUG’, false);

Then you change the word “false” in this line to “true”:

define(‘WP_DEBUG’, true);

Then save changes:

set wp-debug true

Then you browse to one of your site’s pages and check for the displayed error. If the error doesn’t display on your site’s pages, try browsing to the wp-admin page (the page you use to log in to your WordPress) and you should see the errors (or error) displayed.

You might see a lot of errors when you do this. Some will show as “warning” (which aren’t too bad) where as some will show as “PHP Fatal Error”. It’s the fatal errors that you’re best to take note of, as these effectively mean that the error is so serious that WordPress can’t function, and therefore generate page output. 

I’ll cover more about the errors you’ll see, what they mean and how to address them in future posts, as their causes and their fixes can be wide and varied.

How to disable wordpress debugging mode.

Once you’ve fixed the issue with your WordPress site, you’ll need to turn off debugging mode. You can probably see where this is going, but in the interests of being concise, here’s how you’d disable wp-debug (and therefore disable wordpress debugging mode).

Just as you did before, locate and edit the wp-config.php file:

Edit wp-config.php

Then locate the lien that reads:

define(‘WP_DEBUG’, true);

Then you change the word “true” in this line to “false”:

define(‘WP_DEBUG’, false);

Then save your changes:

set wp-debug to false to disable debugging

In summary:

  • You can enable and disable WordPress debugging by changing the WP_DEBUG value in the wp-config.php file from false to true and vice versa.
  • Enabling WordPress debugging mode allows you to see errors when browsing to your site’s pages (specifically the wp-admin page).
  • It’s best to see an error as this allows the cause of the issue to be established (rather than guessing).

You can see some of the fixes for problems encountered when WordPress breaks in this category.

Share this post

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top