At some point, I started getting a message about 311 characters of unexpected output at every plugin activation. The number is always the same, and it happens for every plugin activation, including reactivating plugins that were temporarily deactivated.

The exact message:

The plugin generated 311 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.

Is this likely to be a problem with a plugin that has extra whitespace in its files or something? I haven't yet gotten any problems with headers already having been sent. Possibly it's related to the weird 404 errors I get in wp-admin, but that problem was around long before this unexpected output issue.

  • Could you quote error message exactly?
    – Rarst
    Sep 29, 2010 at 5:59
  • Added exact error message.
    – dgw
    Sep 30, 2010 at 22:49

1 Answer 1


Basically it goes like this (relevant steps only):

  1. plugins.php page calls activate_plugin() function.
  2. Function starts output buffering.
  3. Includes plugin file.
  4. Fires activate_plugin action.
  5. Fires 'activate_' . trim( $plugin ) action.
  6. Fires activated_plugin action.
  7. If buffer is not empty it creates WP_Error object and returns it.
  8. plugins.php page checks for error and displays error message.

So output happens somewhere between steps 2 and 7. If it comes up for multiple plugins then steps 3 and 5 are safe to exclude, they are plugin-specific.

So it is likely something in either activate_plugin or activated_plugin. Also actual unwanted output is passed in WP_Errorobject but not used (only its length).

I'd try to dump hooks first, will take bit of extra code in core a bit to get to that output in WP_Error object.

  • Thanks, Rarst. Problem solved. Dumping hooks using the old (but still usable) System Information plugin led me to the activated_plugin hook. PuSHPress was running code on every activation and causing trouble. I'll report the issue in the plugin's forums. Your pointer is much appreciated!
    – dgw
    Oct 5, 2010 at 21:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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