Checking your logs

The most common scenario for problems is how your server is setup. This is particularly true with self setup servers as the default settings are not always ok for running WordPress - depending on what server you use.

These problems are usually logged somewhere - even if the WordPress error is vague. If you are running your own server see the following. If you are using a host you will need to check your host documentation or contact them for help.

The Wordpress Error log

To check your wordpress error log do this you must turn on debugging in your wordpress config file. Do this from a FTP Browser or hosting panel. Find a file called wp-config.php this will be in the base of your wordpress installation.

Look for this section near the button:

 * For developers: WordPress debugging mode.
 * Change this to true to enable the display of notices during development.
 * It is strongly recommended that plugin and theme developers use WP_DEBUG
 * in their development environments.
 * For information on other constants that can be used for debugging,
 * visit the Codex.
 * @link
define('WP_DEBUG', true); define('WP_DEBUG_LOG', true);;

Where is says define(‘WP_DEBUG’, false); change to:

define('WP_DEBUG', true); define('WP_DEBUG_LOG', true);

Now when you run the sinario that causes a error, wordpress will send debugging information to a file called debug.log that will be in [root wordpress foler]/wp-content/debug.log.

It’s possible that this line has been removed on some hosts. If it isn’t there, just insert before the line:

/* That's all, stop editing! Happy blogging. */`

Log viewer plugin

To view the debug log from your admin panel you can installed the plugin log viewer. Then you can see your log by going to tools > log viewer. But you still need to enable logging to use this plugin.

After you have set debugging to true and you have run the scenario that creates the problem, if the plugin states no file or the debug.log has not been created then there was no WordPress error to log.

If there are errors in this file, please send me a copy to debug.

Displaying errors

Instead of looking in the logs for errors you may want to see more immediate feedback, but bare in mind you don’t want to expose this information if the public can see your page. Add this to the bottom of the wp-config.php file:

ini_set('display_errors', 1);
define( 'WP_DEBUG', true);

Logging with no display

define('WP_DEBUG_DISPLAY', false);
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);

Checking your php error log

If there are no errors in your debug.log then is best to then check your php error log. You can ask your hosting provider for this. But you can also often find it in the root of your WordPress installation, it will be called error_log. It also might be at the root of your account inside a log folder.

Is it safe?

It’s best to do debugging on your staging server. So then there’s no worry. But if you need to debug your live site then it’s best to log without display so that visitors don’t see your error messages.

If working on the live, you need to be very careful to get the syntax right, if for example you copy the above but miss out the last semi-colon, it can break your site. If this happens, just copy and paste it again and make sure you haven’t missed anything. It’s probably a good idea to make a copy of that wp-config.php file before you edit it, just in case you need to revert back to it.

After you have finished, turn off debug mode as it can slow down your site.

Further information

This is a good resource for debugging wordpress: