How to Use WP_DEBUG?

Introduction

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 does it work?

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 the '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.

 

Precautions


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'. 

Are you looking to disable the Deprecated Function in PHP? Please click on Disable > Deprecated Function for more details. 

Related Articles

How to set Email Throttling from SmarterMail?

Email throttling allows system administrators to limit the number of emails transmitted from...

How to edit user quota/mail box size limit in SmarterMail?

Following tutorial will assist you to modify the user quota/mailbox quota from SmarterMail....

How to reset the password of SmarterMail if you forgot the current password?

When you are unable to remind the password of SmarterMail admin user, you can follow these steps...

How do I login to SmarterMail admin panel?

This article will guide you on how to login to SmarterMail admin panel. You can obtain login...

How to Delete an Email Account From SmarterMail?

Following article will assist you to delete an email account from SmarterMail. Login to...

  • 54 Users Found This Useful

Was this answer helpful?