I'm developing a plugin and upon activation, I get the following error:

The plugin generated xxx characters of unexpected output during activation

How can I see what unexpected output is generated?

I have turned on debugging, but it doesn't help:

define('WP_DEBUG', true);
if (WP_DEBUG) {
  define('WP_DEBUG_LOG', true);
  define('WP_DEBUG_DISPLAY', true);
  @ini_set('display_errors', 1);

FYI - I have checked that there are no spaces before and after <?php ?>. I've done some digging around and tested various solutions, but I'm still stuck.


If a plugin has the error output

The plugin generated xxx characters of unexpected output during activation

then that only means that there is some error output.

Sadly WP can't output anything more than this. Every error output sends a header (as var_dump/var_export/print_r/print/error/printf would output.

In short:

You won't get any more info unless you're diggin´ deeper into the plugins code. Your best bet are above ↑ mentioned functions that you could throw into the plugins code to get a real error output.

Short: Sorry to say that, but it is what it is... :/

  • I'm not sure what you mean with above ↑ mentioned functions. It's not possible to generate any output on screen during activation hook, but you can catch error and save it to DB or log file. But I'm not sure how to catch the error. Maybe I can use ob_get_contents() and save it to DB?
    – Steven
    Apr 17 '12 at 23:59
  • @ini_set( 'error_log', ABSPATH.'/log/php_error.log' );. And above mentioned functions are the var_dump/etc functions.
    – kaiser
    Apr 18 '12 at 2:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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