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.
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to change your WordPress login Password using phpMyAdmin

Follow the below steps to change your WordPress login password using phpMyAdmin. Log into...

How to Install WordPress on domains using Softaculous

The below steps will guide you through installing WordPress on your domain within DirectAdmin....

How to increase or change max_input_vars on DirectAdmin

This guide will walk you through changing or increasing max_input_vars for a website hosted on...

How to change upload_max_filesize in DirectAdmin

This guide will walk you through changing or increasing upload_max_filesize for a website hosted...

How to install a Free Lets Encrypt SSL on your Domain with DirectAdmin

This guide will walk you through installing a free Lets Encrypt SSL on your domain within your...