Free coding plugin
WPBeginner developed Insert Headers and Footers, a plugin that you can use to insert code for Twitter cards, Facebook pixel, custom CSS, and others to your WordPress site’s headers or footers. The plugin is compatible with WordPress 4.6 and up. It also supports PHP version 5.2 and up. You can download it free in 22 languages.
You won’t need to edit your theme files with this plugin, but it will let you insert scripts from a single place. Alternative options to this plugin include Header Footer Script Loader, My Header Footer, and AddFunc Head and Footer Code.
Plugin features
Insert Headers and Footers makes it simple to insert scripts into the header or footer areas. You can use it to insert codes for Twitter cards, Facebook pixel, and custom CSS. It supports any code or script, including HTML and Javascript.
The plugin allows you to disable these areas on selected pages using Boolean filters. Depending on the filter, it will disable printing on the entire page or only for the header or footer of the specified page.
How to use
In your WordPress dashboard, navigate to Settings, and then Insert Headers and Footers. It will open a simple screen with three blocks where you can add your scripts:
- ‘Scripts in Header’ adds the scripts to the section.
- ‘Scripts in Body’ adds scripts below the start of the tag.
- ‘Scripts in Footer’ adds scripts above the closing tag.
Once you’ve inserted all the required scripts, click on Save. To double-check, view the page in the front end, and right-click to ‘View Page Source’. Clear your browser and site’s cache if you don’t see the code.
Plugin benefits
The plugin makes it faster to edit codes and prevents errors since it limits the possibility of deleting or placing code in the wrong place when editing theme files. It keeps your changes when your theme file updates. It’s simple to keep up with all your scripts by viewing them in the WordPress dashboard.
Add code to header and footer
The Insert Headers and Footers plugin is an easy way to insert codes into these areas. It has the benefits of reducing errors from editing or deleting codes in your theme files. You can even disable them on specific pages.
The latest release improves the user experience on the Settings page for a customized WordPress installation. It also fixed show settings CTA only to users visiting the settings page.