Enabling debug in WordPress

In my post about troubleshooting WordPress plugin problems I expalined how to disable plugins and themes when you don’t have access to the wp-admin dashboard. But what if that doesn’t fix the problem? Suppose it’s not a plugin or theme breaking the site but something else. The next step in this scenario is to turn on debug in WordPress. To do this you’ll need to add some code to the wp-config.php file which is in the root directory on your server.

You’ll need to use an FTP client like Transmit or FileZilla and find out your server’s FTP credentials (either by asking your host or checking the documentation for your account – most hosts will provide information on how to do this).

Once you’ve signed into your server find the wp-config.php file. I always make a copy of this file before editing it, just to be on the safe side. In Transmit you can copy the file by right-clicking on it and choosing “Duplicate”. Then right-click on it again and choose “Edit in Transmit”.

transmit.png

Add the following code to the file and save it:

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 );

}

Once you’ve done that try loading the site in your browser. This will log error messages to a log file at /wp-content/debug.log. Using Transmit or FileZilla, open this file and see what the error messages say. If all goes according to plan the log file will tell you the cause of the problem.