How to Enable WordPress Error Logs (Simple Guide)

If you’re experiencing issues with your WordPress site, enabling error logging can help you find out what’s wrong. This guide will show you how to turn on WordPress error logs in just a few easy steps.


Step 1: Access Your Website Files

To enable error logging, you’ll need to edit a file called wp-config.php. This file is located in the root directory of your WordPress installation.

How to access your files:

  • Using cPanel: Log in to your hosting account, go to File Manager, then navigate to your WordPress root folder (usually public_html).
  • Using FTP: Use an FTP client (like FileZilla) to connect to your site and open the root folder.

Step 2: Edit the wp-config.php File

  1. Find the wp-config.php file in the root directory.
  2. Right-click and choose “Edit” (or download and edit it with a text editor like Notepad++).
  3. Look for this line:

    define('WP_DEBUG', false);
  4. Replace it with the following code:

    define('WP_DEBUG', true);
    define('WP_DEBUG_LOG', true);
    define('WP_DEBUG_DISPLAY', false);
    @ini_set('display_errors', 0);
  5. Save the file and upload it back (if necessary).

Step 3: View the Error Log

After enabling error logging, WordPress will start recording errors in a log file.

How to find the log file:

  • Go to your WordPress root folder.
  • Open the wp-content directory.
  • Look for a file named debug.log.
  • Open the file to view recent errors.

Step 4: Disable Debug Mode (After Troubleshooting)

Once you’ve identified and fixed the issue, it’s best to turn off debugging to keep your site secure.

  • Open wp-config.php again.
  • Change:

    define('WP_DEBUG', true);

    Back to:

    define('WP_DEBUG', false);
  • Save and upload the file again.

That’s It!

You’ve successfully enabled WordPress error logs. If you need help fixing an error, you can share the error message with a developer or your hosting provider.