I am getting the following error when I activate my plugin:
The plugin generated 22 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.
And here’s my plugin code:
<?php
/*
Plugin Name: Hello World
*/
echo "<h1>Hello, world!</h1>";
?>
I know we get this error usually when there’s some syntax error in the code. I have checked, there are no blank spaces, \n
, \t
, \r
or any kind of special characters at the starting or ending of the file.
I don’t understand, this is the most minimalist plugin one could ever create, what’s wrong?
EDIT 1:
I don’t get the error if I remove the echo "<h1>Hello, world!</h1>";
line.