I encounter a weird error while using the register_activation_hook
and namespace
.
The plugin generated 236 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.
I get this error even with this simple plugin:
<?php
/**
* Plugin Name: Sample Plugin
*
*/
namespace Sample;
register_activation_hook( __FILE__, 'sp_activate' );
function sp_activate() {
}
If I remove the namespace
the error does not occur. Do I miss something? What is wrong here?