WordPress – How to debug unexpected output during plugin activation

Problem

When activating a plugin you receive an ‘headers already sent’ error message which reads

The plugin generated x 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.

WordPress-UnexpectedOutputDuringActivation1

Typically the plugin also fails to activate.

Solution

This issue is typically caused by the plugin being activated having coding (PHP) errors, for example the incorrect usage of a function or a misplaced character.

To debug unexpected output during plugin activation I use a plugin called Debug “unexpected output” During Plugin Activation.

With this plugin installed you’ll see the detail from the x number of characters.

Note: you may need to enable WordPress debug mode to get the full detail from the error message.

If you are not the plugin developer you should get in contact with the developer to give them the opportunity to fix the issue.

WordPress-UnexpectedOutputDuringActivation2

Tags:

Was this article helpful?

Related Articles