In this quick tutorial I will show you how to enable the WP_DEBUG feature and output the results to a log file.
Step 2. Add the following line right after the beginning php tag:
define( 'WP_DEBUG', true );
Step 3. Go to your website and check for errors
Log WordPress errors to a file using the WP_DEBUG_LOG option
Another handy option is the WP_DEBUG_LOG, which in combination to the WP_DEBUG option will save all error messages into a debug.log file located inside the /wp-content/ directory.
To enable debug.log file, add the following code to the wp-config.php file:
Afterwards open the /wp-content/debug.log file and view the errors.
NOTE: Database errors are printed only if WP_DEBUG is set to true. Database errors are handled by the wpdb class and are not affected by PHP’s error settings.