Fix WordPress Debug Mode Not Working – Hostinger

Facing issues enabling WordPress debug mode on Hostinger? Here's how I solved a frustrating bug while integrating a PDF Compressor plugin. Learn the exact fix and see the before/after code in wp-config.php.

While working on integrating a PDF Compressor tool into my WordPress website hosted on Hostinger, I ran into an unexpected roadblock. I needed to debug a critical issue occurring in the admin section of my site, but enabling the WordPress Debug Mode turned out to be more complicated than expected.

This post walks you through the problem I faced, the wrong turns I took, and ultimately how I resolved it. If you’re also stuck with WordPress debugging not working—especially on Hostinger—this might save you some valuable time.


The Problem: Debug Mode Wasn’t Activating

As part of the development process, I modified the wp-config.php file to enable debugging. I added the following lines, as most tutorials and even ChatGPT suggested:

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

But nothing changed. The debug log wasn’t being created. No errors were being logged. It was as if debug mode was never enabled.


Screenshot: Initial wp-config.php File (Before Fix)

The file had a line defining the WP_DEBUG variable, but later in the same file, another block of code updated it as false, along with other debug-related constants.


What I Tried (That Didn’t Work)

  • I followed multiple tutorials that all said the same thing: just enable WP_DEBUG and WP_DEBUG_LOG.
  • I used ChatGPT and forums that repeated the same fix.
  • I even tried enabling the constants in both places in the file—still no success.

The Real Fix: Watch for Overriding Code Blocks

After thoroughly examining the wp-config.php file, I found that WP_DEBUG was defined twice (as mentioned already).

Here’s what was happening:

  1. At the top of the file, WP_DEBUG was being defined.
  2. Later in the file, there was another block that redefined WP_DEBUG, and also set other constants like WP_DEBUG_LOG, WP_DEBUG_DISPLAY, and @ini_set

This second block was somehow causing the issue.

Solution (Step-by-Step):

  1. Make sure WP_DEBUG and WP_DEBUG_LOG are set to true as:
    define( 'WP_DEBUG', true );
    define( 'WP_DEBUG_LOG', true );

    2. Comment out or remove the second block of code that redefines these constants:

      // define('WP_DEBUG', false);
      // define('WP_DEBUG_LOG', false);
      // define('WP_DEBUG_DISPLAY', false);
      // @ini_set('log_errors', 1);
      // @ini_set('display_errors', 0);

      3. Save the file and reload your WordPress site. Check the /wp-content/debug.log file for logs.


        Screenshot: Updated wp-config.php File (After Fix)


        What I Was Building – PDF Compressor Tool

        This debugging hurdle came up while I was building a PDF Compressor and integrating it into my WordPress website. You can check out the live tool here or read the integration blog post for full details.


        Let’s Help Each Other

        If you’ve ever faced something similar, or if this helped you fix your WordPress debug issue, I’d love to hear from you! Drop a comment below and let’s connect.

        Leave a Reply

        Your email address will not be published. Required fields are marked *