Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Node.js, PHP and APIs

WP_DEBUG is set to true but WordPress still shows no errors

Errordefine('WP_DEBUG', true); is set and the page shows no notices or warnings

Short answer

WP_DEBUG only switches debug mode on. Whether you see anything depends on where the constants sit in wp-config.php, on WP_DEBUG_DISPLAY, on quoting, and on whether the code runs in a page load at all. Put the constants above the stop-editing line, and use WP_DEBUG_LOG to read errors from wp-content/debug.log.

  • Applies to WordPress 6.8, PHP 8.3
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    List every debug line in wp-config.php with its line number. Placement and quoting mistakes are visible here.

    grep -n "stop editing\|WP_DEBUG\|display_errors" wp-config.php
  2. 2Match what you see, then jump to its fix

    1. 1The WP_DEBUG line has a higher line number than the stop-editing commentThe constants are below the stop-editing lineFix
    2. 2WP_DEBUG_DISPLAY set to 'false' in quotesA quoted 'false' counts as trueFix
    3. 3No messages on the page, but WP_DEBUG_DISPLAY is false or display_errors is set to 0Display is switched off or only the log is usedFix
    4. 4The admin screen works, but an action fails silently or a scheduled job misbehavesThe error happens in an AJAX request or a cron runFix

What does the error look like?

  • define('WP_DEBUG', true); is set and the page shows no notices or warnings
  • No wp-content/debug.log file appears

Cause 1 of 4

The constants are below the stop-editing line

1Check

The WordPress guide says the debug constants go before the line that reads 'That's all, stop editing'. Open wp-config.php and see where yours sit.

grep -n "stop editing\|WP_DEBUG" wp-config.php

2Fix

Move the define lines above that comment.

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

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

3Verify

Reload a page that has a known notice or warning, then check the page or wp-content/debug.log.

tail -n 20 wp-content/debug.log

Confirmed by developer.wordpress.org

Did this fix it?

Cause 2 of 4

A quoted 'false' counts as true

1Check

The guide warns that the string 'false' is treated as true. A quoted value keeps display on when you meant off, or the reverse.

grep -n "'false'\|\"false\"" wp-config.php

2Fix

Use the bare boolean without quotes.

define( 'WP_DEBUG_DISPLAY', false );

3Verify

Reload the page and read the log if display is off.

tail -n 20 wp-content/debug.log

Confirmed by developer.wordpress.org

Did this fix it?

Cause 3 of 4

Display is switched off or only the log is used

1Check

WP_DEBUG_DISPLAY controls whether errors are printed into the page, and it needs WP_DEBUG to be true. The WordPress example pairs a false display with WP_DEBUG_LOG so errors go to a file instead.

grep -n "WP_DEBUG\|display_errors" wp-config.php

2Fix

To see errors on the page set display to true. To keep the page clean, leave it off and read the log file.

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

3Verify

Trigger the code path again and look at the page or at wp-content/debug.log.

tail -n 20 wp-content/debug.log

Confirmed by developer.wordpress.org

Did this fix it?

Cause 4 of 4

The error happens in an AJAX request or a cron run

1Check

The guide notes that AJAX requests and wp-cron runs do not display errors on a page. The log is the only place they appear, and it needs WP_DEBUG_LOG set to true.

ls -la wp-content/debug.log

2Fix

Turn WP_DEBUG_LOG on and repeat the action. Pass a file path instead of true if you want the log elsewhere.

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

3Verify

Run the action and read the new lines in the log.

tail -f wp-content/debug.log

Confirmed by developer.wordpress.org

Did this fix it?

How do I stop it coming back?

  • Keep the debug constants together in one block above the stop-editing comment.
  • Never leave WP_DEBUG_DISPLAY on for a public site; log to a file instead.
  • Write booleans without quotes.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Back end

Apache returns 403 when a URL contains %3F

a request like /page%3Fname=test is refused while /page?name=test works

Recent Apache httpd blocks a rewrite when the request contains an encoded question mark (%3F) and the rewritten target has a literal ?.

2 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.