How to Debug WordPress Errors

WordPress debug mode and database query debug mode can be enabled in order to troubleshoot issues experienced with your WordPress website. 

 

Debug Mode

To enable debug mode open your wp-config.php file and find the line :

define('WP_DEBUG', false);

Change this to :

define('WP_DEBUG', true);

 

Save the change and then clear your browser cache and browse to the website page you are experiencing issues on. With debug mode enabled any errors on the page will be displayed. 

Remember to change the line back to false once you have completed your investigation. 

 

The debug output can also be logged for later review. You will need to set WP_debug to true as above and will need to add the below line to your wp-config.php file. 

This will create a debug log file that can be found within wp- content/debug.log.

define( 'WP_DEBUG_LOG', true );

 

If you would like to log the debug output to a file and not have the errors shown on your website, you can keep logging turned on, but turn off the website display by adding the below line to your wp-config.php file.

define( 'WP_DEBUG_DISPLAY', false );

 

Database Query Debug Mode

When troubleshooting database query issues or performance, the below line can be added to your wp-config.php file. This will store each query, the function that is calling the query and the execution time. 

Note that this will cause a decrease in performance so do not leave this enabled longer than is required. 

define( 'SAVEQUERIES', true );

 

The stored information can be found in your database :

$wpdb->queries.
  • wordpress, debug, debug mode, wordpress debug, wordpress error
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to install WordPress

How to install WordPressThis tutorial will show you how to install WordPress.For this tutorial,...

How to update your WordPress installation

How to update your WordPress installationThis tutorial assumes you've already logged in to...

How to write a comment in WordPress

How to write a comment in WordPressThis tutorial assumes you've already logged in to...

How to manage plugins in WordPress

How to manage plugins in WordPressThis tutorial assumes you've already logged in to...

How to manage pages in WordPress

How to manage pages in WordPressThis tutorial assumes you've already logged in to WordPress,...