Register | Login

The plugin generated x characters of unexpected output during activation

Why has my plugin generated unexpected output?

Initially I thought the problem was due to unexpected white space before the <?php or after the ?>. I went through every PHP file and checked every PHP opening and closing tag removing any white space. Frustratingly that didn’t solve the issue.

Then I discovered a great plugin Debug “unexpected output” During Plugin Activation which helped me find the culprit.

When reactivating my plugin the Debug tool showed me that within my plugin I was referencing the WordPress global variable $pagenow without globalising the variable with global $pagenow; so it couldn’t access it.

This is the faulty code…

And here is how I fixed it…

James koussertari

RECENT TUTORIALS

Leave a reply

We use cookies to ensure that we give you the best experience on our website.