I'm currently developing a plugin and have the following problem. When I have errors in the activation routine of the plugin, I don't get any errors displayed (after I activated the plugin). Instead I just get the following message:

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

Until now I managed to find my bugs somehow, but it's pretty slow, because I don't get any errors and thus have no clue where to look for. How do you debug something like this? Is there a way to still display errors?

  • Are you echoing out anything in the register_activation_hook? If so // comment them out. Have you got extra white spaces at the bottom on the script? remove them so the code is the last line. If none of the above work then /* comment out one function one at a time */ until you find the section that is causing it. – Sam May 2 '17 at 19:11
  • Yes, actually I tried echoing stuff I needed for debugging. But it doesn't show, all I get is this message. So apparently I can't echo anything there. But how can you debug anything that is part of the register_activation_hook if not by echoing stuff? – TheKidsWantDjent May 3 '17 at 11:24
  • Can you post your code might help to debug? – Sam May 5 '17 at 6:31
  • I could do that, but I'm rather looking for a solution for my problem, so I can debug stuff my self. Because otherwise I would have to come here every couple of hours because I have a new bug ;) There has to be a best practice or something for my situation, no? – TheKidsWantDjent May 5 '17 at 7:42
  • codex.wordpress.org/Debugging_in_WordPress try this page and also at the bottom there are a few plugins for debugging errors. – Sam May 5 '17 at 7:49

Your Answer

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

Browse other questions tagged or ask your own question.