Header Footer Script Adder – Insert Code in Header, Body & Footer

Plugin Banner

Header Footer Script Adder – Insert Code in Header, Body & Footer

by mahethekiller

Download
Description

Header Footer Script Adder is a powerful and user-friendly WordPress plugin that lets you easily insert custom HTML, CSS, and JavaScript into your site’s header, body, or footer.

You don’t need to edit theme files or worry about losing your code after updates. This plugin keeps your scripts safe, reusable, and flexible with conditional loading and per-page overrides.

✨ Features

  • Add scripts to Header (<head>), Body (after <body>), or Footer (before </body>)
  • Conditional Loading – load scripts sitewide, homepage only, posts/pages, or archives
  • Per-Page Overrides – add unique code for specific posts and pages
  • Code Editor with Syntax Highlighting (CodeMirror)
  • Safe Input Handling – sanitization without breaking valid HTML, CSS, or JS
  • Lightweight and Fast – minimal database queries
  • Block Editor & Classic Editor Compatible
  • Multisite Ready & Translation Ready

✅ Perfect For

  • Google Analytics / GA4 tracking code
  • Google Tag Manager
  • Facebook Pixel and ad tracking
  • Chat widgets (WhatsApp, Crisp, Tawk.to, etc.)
  • Custom CSS and JavaScript
  • SEO and verification meta tags (Google, Bing, Pinterest)
  • A/B testing scripts
  • External fonts and resources

⚙️ Conditional Loading Options

  • Sitewide (all pages)
  • Homepage only
  • Posts & Pages only
  • Archive pages

🔒 Security & Performance

  • Sanitized input to prevent malicious injections
  • Nonce verification for safe form submissions
  • Admin-only access for configuration
  • Clean uninstall process (no leftover data)
  • Minimal performance impact

👨‍💻 Developer Friendly

  • Extensible, documented code
  • WordPress coding standards compliant
  • Translation-ready .pot file included
  • Works with any theme

Donations

If you enjoy this plugin and want to support development, you can buy me a coffee:
👉 https://www.buymeacoffee.com/mahethekiller

Support & Documentation

For support, feature requests, or documentation, please visit the support forum on WordPress.org.

Privacy Policy

This plugin does not collect or share personal data. It only loads the scripts you provide.
Any data collection depends on the external scripts you choose to add (e.g., Google Analytics, Facebook Pixel, chat widgets).

  1. Upload the plugin folder to /wp-content/plugins/ or install via the WordPress dashboard.
  2. Activate the plugin from Plugins Installed Plugins.
  3. Go to Header Footer Script Adder in your admin menu.
  4. Paste your scripts and configure loading conditions.
  5. Save settings and done!

Manual Installation

  1. Download the plugin .zip.
  2. In WordPress Admin Plugins Add New Upload Plugin, select the zip file.
  3. Install and activate.
  4. Configure from Settings Header Footer Script Adder.
  1. <strong>Main Settings Page</strong> – Add scripts globally.

    Main Settings Page – Add scripts globally.

  2. <strong>Code Editor</strong> – Syntax highlighting for easy editing.

    Code Editor – Syntax highlighting for easy editing.

Is this plugin safe to use?

Yes. Input is sanitized, and only admins can add or edit scripts. It follows WordPress security best practices.

Will it slow down my website?

No. It’s lightweight and optimized. Scripts only load where needed.

Can I add scripts to specific pages only?

Yes. Use the per-page overrides in the post/page editor.

Does it support Gutenberg (Block Editor)?

Yes. Works with both Gutenberg and Classic Editor.

Can I use it on multisite?

Yes. Each site can have its own configuration.

Can I add both Google Analytics and Facebook Pixel together?

Yes. You can add multiple scripts in header, body, and footer.

Will my scripts stay if I switch themes?

Yes. Code is stored in the database, not in theme files.

How do I remove plugin data completely?

When uninstalling, you’ll have the option to remove all saved scripts from your database.

Can I insert chat widgets or meta tags?

Yes. The plugin supports any valid HTML, CSS, or JavaScript code.

Per page additions & great support

By someguycalledralph on October 24, 2025

I love this plugin. It allows you to add to <head> on per page basis, which not a lot of these script inserter type plugins do. I use this to preload LCP images on a per page basis, which helps improve your website's core web vitals (better visitor experience, and improved rankings!).

I had one issue, I messaged support, and got a reply AND A FIX in a very short space of time. I was impressed!

If you need to do per page <head>, <body> or footer scripts on a per page basis, this plugin is a winner!

Simple and Reliable

By roimantra on June 19, 2025

I was looking for an easy way to add some custom JavaScript and tracking pixels to my WordPress site without digging into theme files—and this plugin did the job perfectly.

The Header and Footer Script Adder is incredibly straightforward. Just copy your code, paste it into the header or footer box, and you're good to go. It even lets you add scripts to individual pages or posts, which is super useful for things like conversion tracking.

What I really like:

  • Super lightweight – doesn’t slow down my site at all.
  • No complicated setup – very beginner friendly.
  • Works across themes – I switched themes recently, and all my scripts still worked without any issues.

Honestly, it’s one of those plugins that does one thing and does it really well. No clutter, no unnecessary settings—just clean and effective.

If you need to insert scripts without breaking your site or getting lost in code, give this plugin a try. It’s now one of my go-to tools for every WordPress project!

Plugin Review: Header and Footer Script Adder

By abhishekkk on June 19, 2025

I've been using the Header and Footer Script Adder plugin for a few weeks now, and it's been a lifesaver. I needed a simple way to add custom scripts like Google Analytics, chat widgets, and a few tracking codes to my site—without touching theme files or editing functions.php.

This plugin does exactly what it promises. You can easily insert code into the header or footer of your entire site or even just on specific posts or pages. The interface is super simple and straightforward. No bloated settings or confusing options. Just paste your code and save—done!

What I love most is that it works regardless of the theme I’m using, so I don’t have to worry about losing my scripts if I change themes in the future.

Would recommend this plugin to:

  • Beginners who need a quick solution for adding scripts.
  • Developers who want a clean, no-fuss way to insert site-wide or page-level code.
  • Anyone who wants to keep things organized and avoid messing with core files.

There are no unnecessary features, and that's honestly a good thing. It keeps everything lightweight and easy to manage.

Great job to the developer! This one’s staying on my must-have list.

Plugin Works As described

By m254032 on June 19, 2025

This plugin is very simple and easy to use, i have used it in many projects i does what it says. also new update is great.

Invasive & spammy donation requests on every page

By kermit666 on March 13, 2017

This is the reason I'm getting more and more frustrated with WordPress. Can't add a simple <script> element to my site, without having to paddle through 5 lousy plugins… This plugin does fulfil its simple role (that I wouldn't even need if WordPress had built in some elementary HTML customisation), but somehow decided that it's appropriate to spam me and other admins with requests for donations on every dashboard page that we open – and I couldn't disable this without deleting the plugin. Look, I understand you want to make some cash, but then please clearly mark this as freemium or make it a paid thing. This thing you're doing now is just plain rude.

1.0.0

  • Initial release.

1.2.0

  • Added new features and bug fixes.
  • Improved UI for easier code management.

2.0.3

  • Major release.
  • Added global header, body, and footer script support.
  • Conditional loading (sitewide, homepage, posts, archives).
  • Per-page script overrides.
  • Integrated CodeMirror editor.
  • Improved sanitization and security.
  • Block Editor and Classic Editor compatibility.
  • Performance optimizations.
  • Updated documentation.
Back to top