Head, Footer and Post Injections


About WordPress SEO and Facebook Open Graph: I was very unpleased by Yoast invitation to
remove my plugin, and it’s not the case.
Read more here.

Head and Footer Codes

Why you have to install 10 plugins to add Google Analytics, Facebook Pixel, custom
tracking code, Google DFP code, Google Webmaster/Alexa/Bing/Tradedoubler verification code and so on…

With Header and Footer plugin you can just copy the code those services give you
in a centralized point to manage them all. And theme independent: you can change your theme
without loosing the code injected!

Injection points and features

  • in the page section where most if the codes are usually added
  • just after the tag as required by some JavaScript SDK (like Facebook)
  • in the page footer (just before the tag)
  • recognize and execute PHP code to add logic to your injections
  • distinct desktop and mobile injections


A new AMP dedicated section compatible with AMP plugin lets you to inject specific codes in
AMP pages.

Post Top and Bottom Codes

Do you need to inject a banner over the post content or after it? No problem. With Header and
Footer you can:

  • Add codes on top, bottom and in the middle of posts and pages
  • Differentiate between mobile and desktop (you don’t display the same ad format on both, true?)
  • Separate post and page configuration
  • Native PHP code enabled
  • Shortcodes enabled

Special Injections

  • Just after the opening BODY tag
  • In the middle of post content (using configurable rules)
  • Everywhere on template (using placeholders)


The specific bbPress injections are going to be removed. Switch to my
Ads for bbPress, which is more flexible and complete.


This plugin cannot change the menu or the footer layout, those features must be covered by your theme!

Offial page: Header and Footer.

Other plugins by Stefano Lissa:


  • Configuration panel for blog HEAD and footer sections
  • Configuration panel for post content
  • Configuration panel for Facebook "og" tags
  • Configurable snippets of code to be recalled on other configurations (to save time)


  1. Put the plugin folder into [wordpress_dir]/wp-content/plugins/
  2. Go into the WordPress admin interface and activate the plugin
  3. Optional: go to the options page and configure the plugin


FAQs are answered on Header and Footer page.


A really reliable, stable plugin for newletter and social injections

I use this to add in

– newletter sigup after every post
– per-post and page facebook like and share buttons on each page or post (so the individual post gets liked and shared, not just the whole site/facebook page)
– occasional advertising code.

I have used it on 10 sites, never had a single problem or bug. Genius!

Fantastic Plugin!

I love this plugin. I use it with every website I design. Clean, small, does exactly what is says. So valuable in so many situations. I use All-in-One SEO and WP Rocket and this plugin comes in handy for optimization too. Love it!

Amazingly Useful Plugin

I use this plugin on every installation of a WordPress website that I use. It’s great! You can use it for all of the SEO benefits and OGraph/Twitter Card capabilities, or you can choose not to use anything except the ability to inject your own code (for example, Analytics, or Sharing Toolbars) on the exact part of the post/page you want! I highly recommend. I haven’t noticed any issues between Header and Footer Plugin and WP 4.8, even though it’s only tested to 4.7.5

Read all 363 reviews

Contributors & Developers

“Head, Footer and Post Injections” is open source software. The following people have contributed to this plugin.




  • Added the filter “hefo_php_exec” to let a third party to disable the PHP execution


  • Moved the donate png inside the plugin


  • Debug notices fix


  • Debug notices fix


  • Check on content length for injections “skipping” N characters
  • Removed obsolete code
  • Removed script handlers debugger
  • Fixed notice on $post_id


  • Version error (grrr)


  • Fixed an error on menu
  • Added the subscription box
  • Fixed CSS and JS in admin panel


  • Start adding support for amp and amp plugin
  • Removed the Open Graph support (it is now so complex that it became out of scope for this plugin)
  • Add a notice to use Ads for bbPress
  • Home page only injection fix
  • Removed old code
  • Little change to the name to be more descriptive
  • Removed local codemirror and added the one from cdnjs


  • Fixed generics injection tab
  • Fixed mobile footer version
  • Fixed few debug notices


  • Fixed mobile detection injection


  • CodeMirror introduced
  • Better mobile code differentiation
  • Admin interface fixes


  • Reverted 1.6.9 changes which break the blog in some cases


  • PHP execution added to the after “body tag” injection


  • Fixed a debug notice
  • Updated readme.txt


  • Added the just after tag injection


  • Fixed few debug notices
  • Fixed the top and bottom injection controls from post and page editing panels


  • Added a web performance section to force async load of selected JavaScript files


  • Comptibility check


  • Added the css id removal feature for pagespeed. See this page.


  • Notes
  • Performance improvements


  • Code cleanup
  • New notes


  • Added options to remove some head links


  • Sticky plugin removed
  • Compatibility check with WP 4.0
  • Code improvements on buffering


  • Removed a couple of obsolete lines of code
  • Added options to enable tags and categories on pages


  • Fixed a notice for 404 page


  • Version compatibility


  • Added an option to use the post options for pages


  • Fixed the “global post” variable when injections contain php


  • Fixed a link


  • Fixed a debug notice


  • Fixed some debug notices
  • ru_RU translation by Eugene Zhukov
  • Added the “thank you” panel
  • Fixed the missing user agent notice


  • Mobile detection added


  • Full size og:image
  • Improved the bbpress integration


  • Fixed a debug warning


  • Performance improvements


  • Added top and bottom injection controls on single posts and pages


  • Added global variables “hefo_page_top”, “hefo_page_bottom” that, if set to false, blocks the page injection
  • Added global variables “hefo_post_top”, “hefo_post_bottom” that, if set to false, blocks the page injection
  • Added configuration to inject code on excerpts
  • Added global variable $hefo_count which counts the number of process excerpts


  • Chaged the top bar
  • Fixed some CSS


  • Added a SEO option for noindex meta tag on page 2 and up of the home page
  • Added a SEO option for canonical on home page (save you from URLs with query string parameter used by plugins)
  • Added a SEO option for noindex meta tag on seach result pages


  • Removed the init configuration, too much dangerous


  • Added the init configuration


  • Added notes and parked codes
  • Added code snippets
  • $post made global for post and page header and footer


  • Added an important note about tabs and image selection on the facebook tab, only informative
  • Added a .po file, but it is no still time to translate!


  • Fixed the not loading CSS and sone layout problems


  • Fixed the readme file…
  • Fixed some labels
  • Added the screenshots (hope they’ll show up this time…)


  • Added bbPress “compatibility” for og:image Facebook meta tag
  • Administration panel tabbed
  • Added Facebook og:type support
  • Fix the og:image on home page when there is no default image specified
  • Facebook og: tags added earlier on head section that other codes


  • added configuration to inject code before and after pages
  • small graphical changes


  • compatibility check with WordPress 3.2.1
  • updated the Facebook Open Graph image tag (og:image)
  • integrated with WordPress media gallery image picker and uploader
  • some CSS changes
  • added the Satollo.net news iframe
  • added configurations to inject code before and after posts
  • added a PDF manual


  • WP 2.7.1 compatibility check


  • added the german translation by Ev. Jugend Schwandorf – Sebastian M´┐Żller (http://www.ej-schwandorf.de)


  • fixed the usage of short php tag


  • added the “only home” header text