General Solutions&FAQ

Print

Turning on WP_DEBUG Mode in WordPress

WP_DEBUG is a powerful and the most important debugging tool built-in to WordPress. It is a very useful tool when it comes to debugging problems on your WordPress site.

To turn WP_DEBUG mode on you need to access your WordPress site via FTP or file manager, find and open wp-config.php file in the WordPress install root, find the following line of code: (‘WP_DEBUG’, false); and change false to true, so that it loos like this: (‘WP_DEBUG’, true);

Don’t forget to save changes to the file. After this php warnings and errors will start showing on your site pages, like this:

These errors at the top will simplify understanding the nature of the problem you encountered.

Another handy tool is WP_DEBUG_LOG, which can be used in conjunction with WP_DEBUG to save all error messages to a debug.log file.

This is an especially useful feature if you want to review notices later.

To turn it on you need to add the following line of code to your wp-config.php file:
define(‘WP_DEBUG_LOG’, true);

Please note that WP_DEBUG should be turned on of WP_DEBUG_LOG to work.

Error log will be saved in a form of debug.log file in wp-content folder of your WordPress install.

It’s important to keep in mind that WP_DEBUG should not be used on a live site. While it’s a useful feature during development, it can be dangerous on a live site because text in the PHP notices can reveal details about your code, paths and other information to visitors to your site.

You can learn more about debugging in WordPress here.

Leave a Reply

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