Want to quickly add code to your WordPress site’s header or footer tags, without messing with your theme files? You need a simple plugin that will insert your code for you. Check out our Insert Headers and Footers review to see how this plugin can help.
What Is Insert Headers and Footers?
Insert Headers and Footers is a free plugin by WPBeginner that allows you to add insert code into your header and footer throughout your whole website. The code can be easily added and edited right from your WordPress dashboard.
Without a plugin like Insert Headers and Footers, you would have to manually edit your header.php and footer.php theme files if you wanted to add any code.
Using Insert Headers and Footers instead has a lot of advantages. Insert Headers and Footers:
- Is faster: No need to find the right theme file and spend time hunting through code to figure out where to add your own.
- Prevents errors: It’s easy to delete the wrong thing or place code in the wrong place when editing theme files, but a plugin can prevent that.
- Preserves your changes: When your theme updates, you’ll lose any changes you made to the files. Keeping your code separate in a plugin will prevent this.
- Keeps you organized: You can see in your WordPress dashboard at a glance what code and scripts you’ve added to your header and footer.
What Kind of Code Goes in Your Header or Footer?
Certain code snippets must be placed in specific locations on your site in order to work correctly.
If you use Google Analytics on your site, you should place the provided tracking code in the header. Because it’s asynchronous, it won’t affect your page loading times, and placing it in the header provides more accurate statistics.
How to Insert Code in the WordPress Header or Footer
First, install and activate the Insert Headers and Footers plugin.
Now you can navigate to Settings » Insert Headers and Footers to get started.
Any code that you want to appear in your site’s header, within the <head> tag, paste into the first field, Scripts in Header.
Any code that you want to insert into the bottom of each page, right before the </body> closing tag, insert into the second field, Scripts in Footer.
When you’re done, click Save.
That’s it! There’s no need to configure any complicated settings or do anything else.
Not Working? How to Troubleshoot
You can double-check that your code has been inserted by navigating to the front end of your site and viewing the page source. (You can do this by right clicking on the page and selecting View Page Source, though this may work differently depending on the browser you’re using.)
If you don’t see your code, be sure to clear your browser cache and be sure to clear any caching plugin you’re using on your site. For more details, see How to Fix WordPress Website Not Updating Right Away.
Keep in mind that the plugin does not execute PHP code. It’s only for inserting static HTML.
More Free Plugins From WPBeginner
WPBeginner is one of the largest free WordPress resource sites in the world. It has tons of WordPress tutorials that will explain everything you need to know about setting up and using WordPress.
If you’re looking for a quick and easy way to manage your header and footer code, without messing with your theme files or losing them all in an update, then Insert Headers and Footers is the plugin you need.
We give Insert Headers and Footers 5 out of 5 stars. Here is the breakdown of our review scores:
If you liked this article, then please consider following us on Twitter and Facebook. If you have any questions, please let us know by leaving a comment below.