Posted on Leave a comment

How to Enable WordPress Error Logging for Debugging

Bugs happen. When they do, error reporting is needed to squash them. Here is how to turn it on.

Look for these line and/or add them to your WordPress wp-config.php file. This file is located in your WordPress home directory.

// Turn on Debugging
define('WP_DEBUG', TRUE); 

// Yes, log errors please
define( 'WP_DEBUG_LOG', TRUE );

// Let's not show errors on the page.
define( 'WP_DEBUG_DISPLAY', FALSE ); 

Now, when things go bad for WordPress, you can see why by visiting this file:

http://[your-website]/wp-content/debug.log

Now go a step further and turn on PHP Error Reporting. Add this snippet next.

// Turn on Error Reporting
ini_set("log_errors", TRUE);

// Report ALL issues, not just the really bad ones.
error_reporting (E_ALL);

// Let's not show errors on the page.
ini_set ('display_errors', FALSE);

This creates error logs in the folder that they’ve happened in. For WordPress theme and plugin issues, we generally are interested in this file:

http://[your-website]/wp-content/error_log

It’s important to point out that once the bugs are squashed, you probably should turn error reporting off. To do this, simply change each TRUE to FALSE.

Leave a Reply

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