WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I include some div into a plugin I am creating I get an error when activating the plugin. "The plugin generated 33 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."

Though the plugin works on the site but I get an error when activating it. here is the plugin code. I want it to display the text on top of the page. I understand I need to use some hooks, but which one? hre is a link showing what I want. http://wsoplugins.com/wp-content/uploads/2012/04/Captur.png

Plugin Name: test
Plugin URI:
Description: test
Author: Ronny Kibet
Author URI: 
version: 1.0

<div id="bar">hello there</div>
share|improve this question
Where exactly do you want to output this html? Or, what does your plugin exactly do? – Rutwick Gangurde Apr 28 '12 at 12:52
I want the plugin to display the text on top of the page. – Ronny Apr 28 '12 at 13:49
Top of the page? Where exactly? Can you make an image and point where you want the text to appear on your page? – Rutwick Gangurde Apr 28 '12 at 13:52
here is a link showing what I want.wsoplugins.com/wp-content/uploads/2012/04/Captur.png – Ronny Apr 28 '12 at 14:12
Check my answer... – Rutwick Gangurde Apr 28 '12 at 14:38
up vote 1 down vote accepted

The answer...

add_action('init', 'text_on_top');

function text_on_top(){
        <div id="bar">hello there</div>

Never output anything outside of a function, use a suitable action/filter to do so!

share|improve this answer
thank youit worked. :) – Ronny Apr 28 '12 at 15:40
Awesome! Please mark the answer as accepted! – Rutwick Gangurde Apr 30 '12 at 9:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.