I'm getting this message each time I activate my plugin:
The plugin generated 80 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 only way I can suppress the message is to wrap my activation function code in a conditional (**see below).
How should I rewrite this to prevent the alert?
function myPlugin($post)
{
echo "Whatever is here throws an unexpected output alert when the plugin isa activated";
//I can place code here without issue, but anything that is output via echo throws the alert.
}
register_activation_hook(__FILE__, 'myPlugin');
Wrapping the function code in the conditional suppresses the alerts:
function myPlugin($post)
{
global $pagenow;
if ( is_admin() && $pagenow !== 'plugins.php' ) {
echo "No more alerts when its wrapped this way";
}
}
?>