Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

1 Answer 1

up vote 7 down vote accepted

In wp-config.php:

if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
    define( 'WP_DEBUG', false );
else
    define( 'WP_DEBUG', true );
share|improve this answer
2  
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

 
discard

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.