/wp-content/debug.log. Highly recommended for production.$wpdb->queries array. Disable when not profiling queries to save RAM.What is WordPress Debugging Mode?
WordPress Debugging Mode is a core configuration system managed via variables defined inside the main wp-config.php file. Activating these variables forces WordPress to display and log underlying PHP syntax errors, database queries failures, and deprecated function warnings, assisting developers in troubleshooting code errors.
Why Displaying Errors in Production is a Major Security Risk
By default, if a PHP syntax error occurs, PHP prints a stack trace on the user’s screen. While useful during local development, letting users or crawlers view raw errors in production is a critical security vulnerability. Error tracks reveal local directory structures (such as /home/user/public_html/wp-content/...), table column layouts, and database credentials, giving malicious actors blueprints to compromise your system.
The Safe Production Setup: WP_DEBUG_LOG
To safely debug live production sites without exposing warnings to users, developers disable screen displays while enabling system file logging. This saves all stack traces to a secure local file on your server (/wp-content/debug.log) while displaying a clean generic error screen to users:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );Frequently Asked Questions
Q: Where do I paste these debug definition statements?
Paste them directly inside the wp-config.php file located in your WordPress root installation directory, right above the line reading: /* That's all, stop editing! Happy publishing. */.
Q: What is the RAM overhead of SAVEQUERIES?
Enabling SAVEQUERIES forces WordPress to log every single SQL query execution time, parameters, and calling functions in server memory. This increases memory usage and should be disabled once profiling is complete.