# Enabling debugging and the error log in WordPress

> Turn on WordPress debug mode and the debug.log file in wp-config.php to find the cause of errors and blank pages.

Source: https://helpcenter.ruachost.com/wordpress/guides/enabling-debugging-and-error-log-in-wordpress/

Sometimes your WordPress site may encounter issues such as plugin conflicts, theme errors, or the dreaded “white screen of death.” To identify the cause, you can enable **debugging mode** and generate an **error log**. On **ruachost.com**, this is done by editing the `wp-config.php` file.

## Why Enable Debugging?

- Helps identify PHP errors, plugin conflicts, or theme issues.
- Provides detailed error messages for troubleshooting.
- Creates a log file (`debug.log`) for tracking problems over time.

## Steps to Enable Debugging Mode

1. **Log in to your hosting account** (via cPanel or File Manager).
2. Navigate to your WordPress installation directory.
3. Locate and open the **wp-config.php** file.
4. Add the following lines at the end of the file:

   ```
   // Enable WordPress debugging and error log
   define( 'WP_DEBUG', true );
   define( 'WP_DEBUG_LOG', true );
   define( 'WP_DEBUG_DISPLAY', false );
   ```

   - `WP_DEBUG` → Turns debugging mode on.
   - `WP_DEBUG_LOG` → Saves errors to `wp-content/debug.log`.
   - `WP_DEBUG_DISPLAY` → Hides errors from visitors (recommended for live sites).
5. Save the file.
6. WordPress will now log all errors in **wp-content/debug.log**.

## Viewing the Error Log

- Go to your WordPress installation folder → `wp-content`.
- Open the file **debug.log**.
- Review error messages to identify the source of issues.

## Important Notes

- Debugging mode does not fix errors, it only helps identify them.
- Always disable debugging (`WP_DEBUG = false`) once troubleshooting is complete.
- Keep backups before making changes to configuration files.
- For advanced debugging, consider using the **Query Monitor plugin**.

##
