Sometimes when activating a new WordPress plugin you might see a error like this at the top of your WordPress dashboard.
“The plugin generated 2 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.”
The reason for this error is because there are one or more unwanted characters or white spaces in the WordPress plugin file. WordPress plugin files are written in PHP language and PHP files must begin with the PHP start tag – ‘<?php’ and end with the PHP end tag – ‘?>’. There should be no characters or white-space before the or php and WordPress will through an error. When we check my plugin file for this error there were two white spaces I had unintentionally lest just after the PHP end tag, ‘?>’.
(The 2 white spaces are highlighted) I removed those white spaces and reactivated the plugin and the error was gone.
This is error message I’m used to seeing once in a while while I’m doing WordPress development. It might be either when writing a new custom WordPress plugin or trying to activate someone else’s plugin or even maybe when testing some plugin code I just copied and pasted.
I guess its one of those learning experiences in WordPress and PHP. I’ve been using PHP and developing WordPress themes and plugins for sometime now and still I make this mistake once in while. But once you know why you get an error like this, you know what to do when it happens next time 🙂
thank u sir
Thanks Its working for me.
Its working , Thank you
I also found this error when developing my plugin.
The plugin generated 5 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.
Its working , Thank you
Thanks , Its working for me as well