There are many cases you need to insert some lines of code into header or body of your WordPress‘s template.
What you can place into those areas:
- Add 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.
Table of Contents
Header and Footer Scripts
This plugin uses wp_head
and wp_footer
hooks and inserts your codes to respective section of the WordPress template.

The setting page has 2 fields for user to input scripts in header or footer. It also offers an option to input custom script to individual post or page.
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 setting in individual post , this one allows to add content to beginning of the body tag.
It can be downloaded here.