This article describes several settings you can use to help debug WordPress.
WordPress includes several settings that you can use to help debug the main application, themes, your own custom code, and more.
Generally, these settings are intended for use by developers and should not be used on “live” sites. However, you can also use them in certain scenarios to help troubleshoot issues you may be experiencing with third-party code, such as plugins or themes.
To enable debugging mode in WordPress, follow these steps:
Save your changes and exit the text editor. Debugging mode is now active.
When you are done, disable debugging mode by modifying the line in the wp-config.php file as follows:
There are several additional settings you can use to control the debugging information that WordPress provides:
If you are experiencing database issues with WordPress, you can enable query logging. When query logging is enabled, the following items are saved in the global $wpdb->queries array:
To enable database query logging, add the following line to the wp-config.php file:
The following PHP code snippet demonstrates how to dump the entire contents of the $wpdb->queries array to a page:
<?php global $wpdb; print_r( $wpdb->queries ); ?>
To view the official WordPress debugging documentation, please visit https://codex.wordpress.org/Debugging_in_WordPress.