Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A test Gist, with 2 files

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

https://codex.wordpress.org/Editing_wp-config.php#Debug

<?php
/**
* The base configuration for WordPress
*
* The wp-config.php creation script uses this file during the
* installation. You don't have to use the web site, you can
* copy this file to "wp-config.php" and fill in the values.
*
* This example only includes a small portion of the file you would normally get.
*
* @link https://codex.wordpress.org/Editing_wp-config.php
*
* @package WordPress
*/
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 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.