If your WordPress website works as expected you’ll be happy.
But what happens if it doesn’t work as expected? How will you identify the problems and fix it?
Here comes WordPress debug mode. Once you enable the debug mode and debug log in the wp-config file, WordPress will start logging all errors into a debug.log file.
You can view the errors recorded in debug.log file to identify and fix issues.
Let me explain about WP_DEBUG and WP_DEBUG_LOG:-
WP_DEBUG is a PHP constant that can be used to trigger the “debug” mode throughout WordPress. It is assumed to be false by default and is usually set to true in the wp-config.php file on development copies of WordPress.
define( 'WP_DEBUG', true );
WP_DEBUG_LOG is a companion to WP_DEBUG that causes all errors to also be saved to a debug.log log file inside the /wp-content/ directory. This is useful if you want to review all notices later or need to view notices generated off-screen (e.g. during an AJAX request or wp-cron run).
define( 'WP_DEBUG_LOG', true );
NOTE: You must insert the above code BEFORE /* That’s all, stop editing! Happy blogging. */ in the wp-config.php fileCredits
- Icon by Smashicons