How to Use WP_DEBUG?


PHP is a well known programming language used by Wordpress having its own debugging mechanism. WordPress has some pre-defined debugging mechanisms like WP_DEBUG. The WP_DEBUG is a constant located in wp-config.php file of any wordpress based website.


When can we use the WP_DEBUG?

WP_DEBUG is very helpful to debug and identify unknown issues that starts appearing on your WordPress Websites. When WP_DEBUG is enabled, it will start throwing PHP notices, debug messages and deprecated function alerts in your WordPress website. By examining those errors & notices, you can easily identify and update required components of the WordPress or PHP. It is the most helpful function to identify the deprecated function in WordPress themes or WordPress plugins and to avoid the known issues of website hacking.

How can we use the WP_DEBUG?

 To turn on or enable the WP_DEBUG, you have to add the single line of code in wp-config.php file, which is as follows:

define('WP_DEBUG', True );

Enabling WP_DEBUG will fire some additional commands which will increase website load time. So,  it is advisable to keep it disabled unless you need it. By default, WP_DEBUG is disabled, "True" will use to enabled and "False" will use to disabled. 

How it works?

After enabling the WP_DEBUG, WordPress will start generating errors & logs and they will be recorded in debug.log file. The location of debug.log file is "wp-content" folder. You can explore this file to see the list of errors, logs & alerts of your WordPress blog.

It is also necessary to turn on the WP_DEBUG_LOG & turn off 'WP_DEBUG_DISPLAY' feature which will start saving all errors to a debug.log file.

define ( 'WP_DEBUG_LOG', true);
define ( 'WP_DEBUG_DISPLAY', false);

Disabling of WP_DEBUG_DISPLAY will start saving all these logs to your log file.



If you're trying to debug something on your live site, use WP_DEBUG with "DISPLAY" feature "OFF". If this is not done, all the errors and notices will start appearing on the front-end and visible to your site visitors.

If the boolean values are not set in command  ('), it will be considered as 'true'. 

  • 0 Users Found This Useful

Was this answer helpful?

Related Articles

How to move/transfer WordPress website through FTP?

Regardless of the reason, most of people are gone through the stressful experience of moving a...

How to reset WordPress admin user's password?

There are several ways to reset WordPress admin user password in WordPress. A simple method is to...

How To Secure WordPress ADMIN Area?

There have now been several large scale WordPress wp-login.php brute force attacks, coming from a...

How to fix an error SSL certificate problem, verify that the CA cert is OK?

You may encounter this error while performing actions like theme/plugins installation or...

How to Change WordPress Admin Username through MySQL Database?

This article will provide you the step by step guidance on how to change the WordPress admin...