Header Footer Script Adder – Insert Code in Header, Body & Footer
Header Footer Script Adder is a lightweight, highly secure, and performance-optimized WordPress plugin that lets you easily insert custom HTML, CSS, and JavaScript into your site’s header, body, or footer without editing theme files.
Stop modifying your theme’s header.php or footer.php files directly! When you change or update your theme, your crucial marketing, analytics, and tracking codes remain safely stored and active.
The Free Version gives you immediate, bloat-free global text areas to inject your scripts across your site, while the Pro Version unlocks a complete, developer-grade Tag Management System to control exactly how, when, and for whom your scripts execute.
✨ Free Core Features
- Targeted Placements: Add scripts precisely to the Header (
<head>), Body (immediately after<body>viawp_body_open), or Footer (before</body>). - Smart Conditional Loading: Control script visibility sitewide, homepage only, posts/pages only, or archive pages.
- Per-Page & Per-Post Overrides: Inject completely unique tracking codes or custom scripts into specific individual posts or pages.
- Developer-Grade Code Editor: Built-in CodeMirror code editor with full syntax highlighting for error-free coding.
- Secure Input Handling: Robust input sanitization without breaking valid HTML, CSS, or JS scripts.
- Lightweight & Fast: Zero bloat architecture that minimizes database queries to protect front-end site speed.
- Full Compatibility: Works seamlessly with the Block Editor (Gutenberg), Classic Editor, and WordPress Multisite installations.
✅ Perfect For
- Analytics & SEO: Google Analytics / GA4 tracking code, Google Tag Manager (GTM), and SEO verification meta tags (Google Search Console, Bing, Pinterest).
- Conversion Tracking: Meta (Facebook) Pixel, TikTok Pixel, Pinterest Tag, and ad tracking scripts.
- User Engagement: Live chat widgets (WhatsApp, Crisp, Tawk.to, HubSpot).
- Custom Styling & Scripts: Global or page-specific custom CSS modifications and JavaScript actions.
🚀 Upgrade to Pro: Unlock Ultimate Control & Speed
For advanced developers, agencies, and e-commerce stores, the Pro version transforms your setup into an advanced tracking engine:
-
1. Granular Conditional Targeting:
- User Role Targeting: Load scripts for Everyone, Logged-In Users Only, Logged-Out Users Only, or specific roles (Administrator, Subscriber, WooCommerce Customer, etc.).
- Device Targeting: Optimize layouts by choosing to load scripts only on Desktop, Tablet, or Mobile devices.
- Advanced Page-Specific Targeting: Target specific Custom Post Types or key WooCommerce Pages (Shop, Cart, Checkout, Single Products) to eliminate checkout tracking discrepancies.
-
2. Core Web Vitals & Performance Optimization:
- Loading Strategies: Automatically inject
async(non-blocking) ordefer(delayed execution) attributes into scripts to skyrocket your Google PageSpeed scores. - Flexible Injection Methods: Print code Inline directly to the page, or as an Enqueued File to take advantage of browser caching.
- Automatic Code Minification: Automatically strips comments and whitespace from your custom snippets to reduce payload size.
- Loading Strategies: Automatically inject
-
3. One-Click Native Pixel Integrations: No more copying messy code blocks. Simply paste your tracking IDs for optimized, automated deployment of:
- Google Tag Manager (GTM): Automated header script and body
<noscript>fallback setup. - Google Analytics 4 (GA4): Cleanly enqueues the modern Global Site Tag (
gtag.js). - Meta Facebook Pixel: Automated base header code and noscript image tag fallback.
- Google Tag Manager (GTM): Automated header script and body
-
4. Complete Snippet Management System (CPT): Move beyond global boxes into an organized, custom post type management engine:
- Unlimited Isolated Snippets: Create distinct, named snippets for individual marketing campaigns instead of mixing all code together.
- Execution Priority Control: Assign execution weights (e.g., Priority 10 vs 50) to strictly command the exact order scripts print to the page.
- Instant Status Toggles: Safely toggle individual snippets Active or Inactive with a single click without deleting your code.
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 official support forum on WordPress.org.
Privacy Policy
This plugin does not collect or share personal data. It only safely loads the scripts you explicitly provide. Any data processing relies entirely on the external scripts you choose to implement (e.g., Google Analytics, Facebook Pixel).
