Tag: Debugging

Debugging Errors With WordPress

Debugging your PHP errors is very easy with just a few lines in your wp-config.php file. By adding the following code to the wp-config.php file – you will turn off displaying the errors to users while logging them to a log file for your review.

define('WP_DEBUG', true); // or false
if (WP_DEBUG) {
  define('WP_DEBUG_LOG', true);
  define('WP_DEBUG_DISPLAY', false);
  @ini_set('display_errors',0);
}

Documentation: http://codex.wordpress.org/Editing_wp-config.php#Configure_Error_Log

*Note from the documentation: The log file will be called debug.log located in /wp-content. You may need to create it with appropriate permissions (666) first if your web server does not have write access.

Hopefully by logging the errors – you can easily debug any issues without having any users see them while browsing the site.