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:
define('WP_DEBUG', true);
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:
define('WP_DEBUG', false);
There are several additional settings you can use to control the debugging information that WordPress provides:
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
define('SCRIPT_DEBUG', true);
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:
define('SAVEQUERIES', true);
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.
Subscribe to receive weekly cutting edge tips, strategies, and news you need to grow your web business.
No charge. Unsubscribe anytime.
Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.
Usamos cookies para personalizar o site para você e para analisar o uso do nosso site. Você demonstra que concorda com isso ao clicar em "Eu concordo" ou ao continuar usando este site. Mais informações sobre cookies podem ser encontradas em nossa Política de privacidade.