What is WP DEBUG: A Comprehensive Guide

What is WP DEBUG: A Comprehensive Guide

Turning on WP_DEBUG on your WordPress site can give you a better understanding of what’s happening on it, especially when there is an issue. It will also be beneficial for any theme or plugin developers who want their product to be publicly promoted by WordPress.

Therefore, in this article, we will show you everything you need to know about WP_DEBUG and how you can make use of it for your website’s development.

Why is WP_DEBUG Important?

WP_DEBUG is a PHP constant that triggers debugging mode in WordPress. You can find it inside your wp-config.php file. While this mode is disabled by default, you can do many important tasks with it once it’s enabled.

First, it will give you information about how to reproduce an issue. By saving a log file, it records all activities happening on your site and that can help to troubleshoot a problem.

Secondly, WP_DEBUG will display a list of deprecated functions in WordPress theme or plugin releases. These are functions that are marked as inactive in the future. This notification also often lets you know what alternatives can be used instead.

Another important reason for enabling debugging comes when you want to build a theme or plugin.

WordPress Codex highly recommends that every developer use WP_DEBUG when creating their product so that when there’s a problem or warning, another developer can inspect and fix the code.

If it isn’t compatible with WP_DEBUG, the official WordPress tool library won’t endorse your plugin or theme.

Practical Uses of WP DEBUG

Having explained the general idea of what WP_DEBUG is, now we are going to cover practical use.


WP_DEBUG is located in the wp-config.php file and by default has the value set to “false”. If you want to enable it, you have to change it to “true”. To do so, you will need an FTP client, like FileZilla or a file manager to access the file.

In our example, we will use the Hostinger File Manager.

  1. Find the wp-config.php file in the root folder of your website. In our example, it is in hostinger-dev-9.xyz/public_html/wp-config.php.wp-config.php file location
  2. Open it and search for
    define( 'WP_DEBUG', false )

    How to enable WP_DEBUG

  3. Once located, change false into true. Then, save the file.

If there is no such code in your wp-config.php file, you can add it above the /* That’s all, stop editing! Happy blogging. */ line.

Keep in mind that debugging should not be enabled in a live website because this mode is designed for development purposes only.


By enabling WP_DEBUG_LOG, users are able to save all errors in a debug.log file. This function works hand in hand with WP_DEBUG and can help reproduce problems for troubleshooting.

To enable it, open the wp-config.php file and enter this following line under define( ‘WP_DEBUG’, true );

define('WP_DEBUG_LOG', true);

How to enable WP_DEBUG_LOG

After you activate the function, the debug.log file will be automatically saved in the /wp-content/ folder of your website. You can directly view the file in your browser.

debug.log file location inside the WordPress directory


You should disable WP_DEBUG_DISPLAY so the error messages won’t be displayed on your website.

By default, every time there’s an error, it will be generated and shown inside your HTML code. And unlike WP_DEBUG, the original value is “true” and you have to change it to “false” to hide all errors.

Or if it isn’t available, you need to insert this line in the wp-config.php file just below the define(‘WP_DEBUG’, true); line.

define('WP_DEBUG_DISPLAY', false);

How to hide all errors by disabling WP_DEBUG_DISPLAY

All of these features: WP_DEBUG, WP_DEBUG_LOG, and WP_DEBUG_DISPLAY can be used all at once to enable debugging, save a log file and hide all the errors.


Understanding how to use WP_DEBUG has many important benefits for WordPress site owners and developers alike. You can use it to enable debugging mode and save or hide all errors for better website development. What’s more, the process is actually pretty easy.

Here’s a summary of all steps to make use of WP_DEBUG, WP_DEBUG_LOG, and WP_DEBUG_DISPLAY:

          • WP_DEBUG — Find the wp-config.php file and set define( ‘WP_DEBUG’, false );  to true.
          • WP_DEBUG_LOG — Add define(‘WP_DEBUG_LOG’, true); under the define(‘WP_DEBUG’, true); line.
          • WP_DEBUG_DISPLAY — Enter define(‘WP_DEBUG_DISPLAY’, false); under the define(‘WP_DEBUG’, true); line.

If you have any questions, just hit us up in the comment section down below!

The Author


Irfan F. / @mirfan

Irfan is a member of the Digital Content Writer team at Hostinger. He believes that technology and the internet can help improve our lives significantly. That's why he shares his experience as a WordPress blogger to educate others. In his free time, Irfan enjoys good films and books.


Khaleeq Reply

July 09 2020

I have followed the above procedure , but its still showing the same debug error, it shows the statement: " There has been a critical error on your website" . How can I solve it?


    Tomislav T.

    Replied on July 14 2020

    Hey there Khaleeq! :) Having the Debug feature on doesn't just resolve the issue - it shows you what went wrong, and how to resolve it. You need to follow the log report and then resolve the issue that way.


Yasmine Reply

August 11 2020

Hello I don't know why I cannot edit my website, it gives me the message: There has been a critical error on your website. Please check your site admin email inbox for instructions. Learn more about debugging in WordPress. which brings me there https://wordpress.org/support/article/debugging-in-wordpress/ I have had this message before, about debug true or false, I changed it once to true, then had to change to false again (a few months ago)because apparently it's not good to leave it true, kept giving me error messages on my website (final view) However if I change to true or false this time, it doesn't really make any difference, I still get this message. I can go in the dashboard but when I want to edit I get this message on a blank page. What can I do? Please help, I urgently need my website for some job and I need to finish it. thanks


    Tomislav T.

    Replied on November 06 2020

    Hey Yasmine. This error usually appears after updating a plugin, theme, or changing the PHP version. This can happen due to miscommunication between two plugins, plugin and a theme, or plugin/theme/php version (any link between the two). Feel free to message our Customer Success team via your account for more help! :)


Yasmine Reply

August 11 2020

Hello Tomislav "Having the Debug feature on doesn't just resolve the issue - it shows you what went wrong, and how to resolve it. You need to follow the log report and then resolve the issue that way." Can you explain how? where is that report?


    Tomislav T.

    Replied on August 25 2020

    Hey Yasmine! :) Here is a small guide on how to check the error logs!

Leave a reply




This site uses Akismet to reduce spam. Learn how your comment data is processed.

Become a part of Hostinger now!

More in WordPress