Add Meta Tag and JavaScript into Header or Footer of WordPress

There are many cases you need to insert some lines of code into the header or body of your WordPress template.

What you can place into those areas:

  • Add a meta tag to verify an external service like Google Webmaster Tool.
  • Add Google Analytics script.
  • A JavaScript script or import a script library.
  • Custom stylesheet.

Creating a module for that purpose is overkill, so we will use a plugin.

Header and Footer Scripts

This plugin uses wp_head and wp_footer hooks and inserts your codes to the respective sections of the WordPress template.

The setting page has 2 fields for the user to input scripts in the header or footer. It also offers an option to input a custom script to an individual post or page.

Download plugin

Insert Headers and Footers

Insert Headers and Footers is also a simple plugin to insert code like Google Analytics, custom CSS, Facebook Pixel, and more to header and footer sections.

While the previous plugin allows script set in an individual post, this one allows the addition of content to beginning of the body tag.

It can be downloaded here.

Leave a Comment

Your email address will not be published. Required fields are marked *


Scroll to Top

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close