sandywp / plugins / header-and-footer-script-adder

Header Footer Script Adder

4.1 out of 5 stars. 4.1 7 reviews

Easily insert custom HTML, CSS, and JavaScript into your WordPress site's header, body, and footer without modifying theme files.

Launch a sandbox with this plugin → No signup.
Ready in seconds.

v2.1.1 1,000+ installs WP 6.0+ PHP 7.4+

your-sandbox.sandywp.com/wp-admin
Header Footer Script Adder running inside a SandyWP sandbox

What you get inside

5 screens
  • Main Settings Page – Add scripts globally.

  • Code Editor – Syntax highlighting for easy editing.

  • Conditional Options – Control script placement (sitewide, homepage, archives, etc.).

  • Per-Page Overrides – Unique scripts per post or page.

  • Help Section – Usage instructions and FAQs.

About this plugin

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).

Questions

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.

4.1

7 reviews

  • 5 ★ 4
  • 4 ★ 2
  • 3 ★ 0
  • 2 ★ 0
  • 1 ★ 1

Ratings come from WordPress.org. SandyWP does not collect its own reviews.

Spin up a real WordPress site in seconds.

Test plugins, build a demo, hand a client a link — then squash it and start again. No local setup, no Docker.