I’m developing WordPress plugin and do get this error on activation:
Error : The plugin generated 4 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 snippet below illustrates how my plugin looks like:
<?php
/*
Plugin Name: XXXXX
Plugin URI: XXXXX
Description: XXXXX
Version: 1.0
Author: XXXXX
Author URI: XXXXX
License: GNU
*/
echo"test";
?>
What is causing this error and how can I resolve it?
A couple of issues:
Your plugin shouldn’t directly
echo
anything. Instead, add yourecho
to a WordPress hook if you need to test things. For example, replace yourecho "test";
with something like:It’s recommended to remove the closing
?>
tag, to avoid “Headers already sent” notifications.