WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

It is highly recommended practice (that I completely agree with) to develop with WP_DEBUG enabled. However it is merely inconvenient to see not yet fixed warnings in pages, but in Ajax responses they ruin response completely.

I am just starting with Ajax in WP, is there some appropriate hook to suppress errors for Ajax responses only?

PS fix everything is not viable option at moment, because it is extremely extensive and complex environment :)

share|improve this question
up vote 9 down vote accepted

In wp-config.php:

if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
    define( 'WP_DEBUG', false );
    define( 'WP_DEBUG', true );
share|improve this answer
Ah, thank you. Didn't realize that DOING_AJAX is defined very early, right at start of admin-ajax.php – Rarst Mar 30 '11 at 17:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.