描述
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).
安装
- Go to your WordPress Dashboard, navigate to Plugins Add New, and search for Header Footer Script Adder.
- Click Install Now and then Activate the plugin.
- Access the configuration dashboard by navigating to Settings Header Footer Script Adder in your admin menu.
- Paste your code snippets, configure your loading conditions, and click Save.
Manual Installation via ZIP
- Download the plugin
.zipfile from the WordPress repository. - In your WordPress Admin, go to Plugins Add New Upload Plugin and select the zip file.
- Install, activate, and navigate to Settings Header Footer Script Adder to begin.
常见问题
-
Is this plugin safe to use?
-
Yes. All inputs are sanitized, and access is restricted strictly to administrators to prevent unauthorized script injections. It strictly adheres to WordPress core security standards.
-
Will it slow down my website performance?
-
Not at all. The plugin is intentionally lightweight and optimized. Scripts are only queried and executed on the specific pages you designate via conditional formatting.
-
Can I add scripts to a single page only?
-
Yes. You can use the per-page override settings directly within the post or page editor sidebar to inject exclusive scripts.
-
Does it support Gutenberg (Block Editor)?
-
Yes. It is fully compatible with both the modern Gutenberg Block Editor and the legacy Classic Editor interface.
-
Can I run this on a WordPress Multisite network?
-
Yes. The plugin is multisite ready, allowing each sub-site on your network to maintain its own independent script configuration.
-
Can I insert multiple scripts into the same section?
-
Yes. You can paste multiple independent scripts (e.g., Google Analytics and Facebook Pixel together) sequentially into the header, body, or footer areas.
-
Will my tracking codes disappear if I switch my theme?
-
No. All codes are securely written into the WordPress database, meaning you can swap, edit, or update themes without ever losing your tracking configurations.
-
How do I remove plugin data completely?
-
Upon uninstallation, the plugin provides a clean teardown option to wipe all saved script configurations completely from your database.
-
Will adding tracking pixels slow down my Core Web Vitals?
-
Third-party scripts are the #1 cause of poor mobile page speed. While the Free version prints scripts exactly as you paste them, the Pro version includes built-in optimization tools. You can apply “Async” or “Defer” tags to your scripts with a single click, or force them to load as enqueued files to maintain blazing-fast loading speeds and high Google PageSpeed scores.
-
How do I upgrade to the Pro version?
-
Upgrading is completely seamless. Once you are ready to unlock advanced targeting and optimization, navigate to the “Header Footer Script Adder” menu in your WordPress dashboard and click on the “Upgrade” or “Go Pro” tab to securely purchase and instantly activate your premium license via Freemius without losing any of your existing scripts.
评价
贡献者及开发者
「Header Footer Script Adder – Insert Code in Header, Body & Footer」是开源软件。 以下人员对此插件做出了贡献。
贡献者更新日志
2.0.7
- Converted plugin architecture to a unified Single Version Model.
- Integrated Freemius SDK for secure premium features delivery.
- Added Pro Version upgrade dashboard and conditionally-loaded premium code structure.
- Verified compatibility with latest WordPress version 6.7.
2.0.6
- Fixed a few security issues.
2.0.5
- Minor bug fixes and improvements.
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.
1.2.0
- Added new features and bug fixes.
- Improved UI for easier code management.
1.0.0
- Initial release.


