Debug WordPress

WP_DEBUG is an useful debugging tool available in WordPress to see PHP errors on your website and they are helpful for developers to troubleshoot issues with the website.

To turn on WP_DEBUG, add following code in wp-config.php

define(‘WP_DEBUG’,true);

It is not advisable from security point of view to turn on WP_DEBUG on production websites as it will reveal sensitive information of your code and other information to website visitors.

So instead of displaying errors on the website, you can use WP_DEBUG_LOG to write error logs on a debug.log file and turn off displaying errors using WP_DEBUG_DISPLAY

To turn on WP_DEBUG_LOG and turn off WP_DEBUG_DISPLAY, add following code in wp-config .php

define(‘WP_DEBUG_LOG’,true);

define(‘WP_DEBUG_DISPLAY’,false);

@ini_set(‘display_errors’,0);

The debug.log file is located in /wp-content/ directory of your site.

All in One WordPress Hosting Starts at 30$ per month
All in One WordPress Hosting
WordPress
High optimized WordPress hosting, secure firewall, HTTPS, Backup, hack-fix guarantee and many others at 30$ per month