You turn on WordPress debug mode by adding a few constants to your wp-config.php file, which helps pinpoint what is breaking your site.
Add these lines to wp-config.php, above the line that reads /* That's all, stop editing! Happy publishing. */:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
With this setup, WordPress records PHP warnings, notices, and errors to a log file at /wp-content/debug.log instead of printing them on the page. Logging rather than displaying is important on a live site, so visitors never see raw error messages.
If you want to load the unminified versions of WordPress's own scripts and styles while debugging front-end issues, also add:
define( 'SCRIPT_DEBUG', true );
Turn debugging off again by setting WP_DEBUG back to false once you are done. For a more readable view of queries, hooks, and errors during development, the free Query Monitor plugin is a helpful companion. If you find a memory-related error in the log, see Increasing the WordPress Memory Limit.