To debug a WordPress setup, you just need to add the line below in wp-config.php
define('WP_DEBUG', true);
Most likely, the line will be there by default. You just need to change the false
flag to true
.
Better WordPress debugging…
I am not a fan of the above method even though it is commonly preferred. This is because using WP_Debug outputs all error messages on screen. If you are working on Ajax-based application, debug output can mess your server-side response, and break your Ajax calls.
I will recommend using the lines below in wp-config.php
define('WP_DEBUG', true); define('WP_DEBUG_DISPLAY', false); define('WP_DEBUG_LOG', true); define('SAVEQUERIES', true);
The first line will turn on debugging.
The second line will prevent errors from being displayed on the screen.
The third line generally logs errors in a /wp-content/debug.log
file. You may not see this file on Nginx, so look out for Nginx’s error log file. If you are following our WordPress-Nginx setup convention, then for domain example.com
, you can find logged errors in /var/www/example.com/logs/error.log
Otherwise, errors might be logged to Nginx’s default error log, mostly /var/log/nginx/error.log
file.
More…
- Maintaining, Optimizing & Debugging WordPress-Nginx Setup
- Also read Debugging in WordPress from codex