Enable WordPress debug mode

By default, WordPress debug mode is disabled. Error handling and display depend on the server settings. In most cases, this means that errors will not be displayed (even fatal errors), but they should be logged into the file (again, depends on server settings, and it can happen that logging of errors is disabled).

Basic Debug Mode

To enable WordPress debug mode, you need to add WP_DEBUG constant set to TRUE into wp-config.php file. Recently, wp-config.php has a definition for this constant included and set to FALSE. So, you need to have this line in your wp-config.php:

define('WP_DEBUG', true);

This will activate error reporting for all types of errors including strict and deprecated errors.

Additional Debug Settings

There are two more debug constants that can be used if WP_DEBUG is active:

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

The first one will activate (or force) display of errors on the screen. The second one will activate logging errors into the file. This file will be debug.log in your wp-content folder.

Best way to enable debug mode

For having debug mode active, but to only save debug information to log file, and not to display it on screen use this:

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

This is the best way to get all the errors in the log, and not have them displayed on the page.

Rate this article

You are not allowed to rate this post.


Leave a Reply