How to turn on debug mode in WordPress using wp-config.php

Peter posted this on November 15, 2023


Had a client’s site bringing up a critical 500 Internal server error whenever they tried to save anything which wasn’t getting logged in the normal error log.

We went through this process to turn on WordPress’s native debug log to could see what was going on.

This video was made after the fix but the first issue was, it was a new cpanel account so PHP memory was set really low,
The second issue was, a WordPress plugin conflict was causing the website to use up a lot of memory.

To turn on the native wordpress debugger,

1. Visit the File Manager for your website

2. Look for wp-config.php and click edit.

3. Scroll down to the line with:
define( ‘WP_DEBUG’, false );

Change it to:

define( ‘WP_DEBUG’, false );
4. Paste the following code immediately after that and save.

// Enable Debug logging to the /wp-content/debug.log file
define( ‘WP_DEBUG_LOG’, true );

// Disable display of errors and warnings
define( ‘WP_DEBUG_DISPLAY’, false );
@ini_set( ‘display_errors’, 0 );

// Use dev versions of core JS and CSS files (only needed if you are modifying these core files)
define( ‘SCRIPT_DEBUG’, true );

5. Trigger the action that threw the error and then go back to your file manager

6. Go to the wp-content folder, there should be a new debug.log file there with any errors generated.

Post A Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.