Good day for all

I really searched SE for something like this but found nothing related.

It is a noob question really but getting answered will make me comfortable with myself :)

After setting the header section of a test plugin file I just put an echo statement.

When I activate the plugin the string of the echo gets displayed on the admin dashboard page as well as on the home page.

Is this common sense on WP or am I missing something ?

thank you a lot.

  • 1
    What else did you expect? – fuxia Feb 17 '14 at 8:52
  • i expected the state of the plugin to be changed to activated but not the contents to be shown on the front page and the dashboard . if you put ae echo on the index.php on lets say the akismet plugin it wont show anywhere. – hanachi Feb 17 '14 at 8:54
  • Plugins are just PHP files. When they are included their code is interpreted. – fuxia Feb 17 '14 at 8:55
  • yes i think that wp searches for the file that contains the header section and includes it on at least front page and admin page !! – hanachi Feb 17 '14 at 9:02
  • There are conditions. If the condition says that you can show the echo on admin area as well as on the homepage then it'll. – Sudeep K Rana Feb 17 '14 at 9:14

Yes, it is common sense and you are missing something ;)

Plugins are just away to add code to wordpress, by default they are not inferior or restricted in any way more then then core code. Just another file(s) that wordpress includes on startup.

It is your job as a plugin developer to restrict the execution of your code to specific area/context, and you do it by hooking your code on the relevant actions and filters.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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