While simple in premise, at the time of writing this nifty little plugin is coming close to a million installations, which is no mean feat!
I personally use this plugin on all of my own sites for one important reason: the plugin helps me implement a standardised way of dealing with all the various JS codes I use on my websites, while ensuring the functionality is broken out of the theme itself.
Huh? OK, let me simplify that…
Depending on what theme you use, you might find that it offers handy built-in tools that let you accomplish a number of tasks from within the theme itself. The popular Tag Divi Newspaper theme comes to mind; offering built-in tools to add JS code to your site’s header and footer without the need for extra plugins. You can pop everything from Google Search Console meta verification tags through to Google Analytics and Adsense code right there in the theme.
While this convenience can be great, it can also cause some huge facepalm moments, too. Change theme and forget you had those codes entered in the theme directly… yep… you could come back months later to look at your analytics data only to find the code deleted ever since you switched themes.
This problem can grow quickly, especially if you have a large number of websites to manage, all using different themes and setups. The simple solution is to ensure your site’s functionality (plugins) is kept as separate from the presentation (theme) as possible. Changing one won’t hurt the other.
Once installed, this lightweight plugin adds a new entry in your WordPress dashboard settings area. Once clicked, it presents two simple boxes; one for code in the <head> tag of your site, and one for the <footer>.
You can find the Insert Headers and Footers plugin for free, right in the plugin repo: