Skip to content

Instantly share code, notes, and snippets.

@jeherve
Last active April 12, 2021 11:08
Show Gist options
  • Save jeherve/e6acfc973c07cb500836804e1044d12a to your computer and use it in GitHub Desktop.
Save jeherve/e6acfc973c07cb500836804e1044d12a to your computer and use it in GitHub Desktop.
How To: Enable Debugging in WordPress

Enable Debugging in WordPress

To enable debugging in WordPress, you will need to add the following to your site's wp-config.php file:

define( 'WP_DEBUG', true );

if ( WP_DEBUG ) {
	@error_reporting( E_ALL );
	@ini_set( 'log_errors', true );
	@ini_set( 'log_errors_max_len', '0' );

	define( 'WP_DEBUG_LOG', true );
	define( 'WP_DEBUG_DISPLAY', false );
	define( 'CONCATENATE_SCRIPTS', false );
	define( 'SAVEQUERIES', true );
}

Your wp-config.php file may already include a line that says define( 'WP_DEBUG', false );. You can remove it, and replace it by the code above.

Once you've done so, try to reproduce the issue you were facing.

Then, check the wp-content/debug.log file for errors in your WordPress installation. You will need to access this file via FTP, much like you have done to edit wp-config.php.

The file should give you some details about the most recent errors on your site, and in what file they occurred.

Once you figure things out, do not forget to replace define( 'WP_DEBUG', true ); by define( 'WP_DEBUG', false ); in wp-config.php to disable debugging.

More information and resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment