Head & Footer Code

Easily add tracking pixels, analytics, custom scripts, and CSS to your site. No coding skills required. Perfect for marketing teams and developers.

Head & Footer Code makes it simple to add any third-party code snippet to your WordPress site without touching theme files. Whether you need to install Google Analytics, Meta Pixel, site verification codes, custom CSS, or any other script, just paste it in and you’re done.

Features

Why choose Head & Footer Code?

  • No theme editing required – Keep your theme files clean and safe
  • Granular control – Add code site-wide, per category/tag, or per individual post/page, or even per custom post type and custom taxonomy
  • Three strategic locations – Insert code in <head>, after <body>, or before </body>
  • Marketing-friendly – Non-technical users can manage tracking codes independently
  • Developer-friendly – Priority controls and debug mode for advanced customization
  • Multisite compatible – Perfect for WordPress networks with role-based permissions

Integrate all your favorite tools

Analytics & tracking

  • Google Analytics 4 (GA4)
  • Google Tag Manager
  • Lite Analytics and privacy-focused alternatives
  • Custom event tracking scripts

Marketing & conversion

  • Meta Pixel (Facebook Pixel)
  • Google Ads conversion tracking
  • LinkedIn Insight Tag
  • Twitter/X Pixel
  • TikTok Pixel
  • Pinterest Tag

User experience & heatmaps

  • Hotjar session recordings
  • FullStory user analytics
  • Crazy Egg heatmaps
  • Mouseflow visitor tracking

Site verification & SEO

  • Google Search Console verification
  • Bing Webmaster Tools verification
  • Yandex site verification
  • Pinterest site claim
  • Schema markup and structured data (JSON-LD)

Design & styling

  • Custom CSS for site-wide design tweaks
  • Google Fonts and Adobe Fonts (Typekit)
  • Font Awesome and icon libraries
  • Critical CSS for performance

Plus any custom code

  • JavaScript libraries and frameworks
  • Third-party widgets and embeds
  • A/B testing scripts (Optimizely, VWO)
  • Live chat code snippets
  • Custom HTML anywhere on your site

Three levels of control

Site-wide code

Go to Tools → Head & Footer Code to add code that appears across your entire website.

Taxonomy-specific code

Add unique tracking or styling to specific categories (e.g., different pixels for product vs. blog categories).

Article-specific code

Use the metabox when editing any post, page, or custom post type to add unique code just for that page. Choose whether to append to or replace site-wide code.

Special features

Homepage control (Blog mode)

If your homepage displays the latest posts, you can add homepage-only code and control whether it appears on paginated pages (eg, page 2, 3, etc.).

Priority management

Fine-tune the order of the code execution by adjusting priority values (for developers who need precise control).

Role-based permissions

Allow Editors and Authors to manage article-specific code – great for marketing teams on multisite installations.

Debug mode

Enable WP_DEBUG to see HTML comments in page source showing exactly where each code snippet is inserted.

Technical Details & Architecture

Technical specifications

  • PHP 8.5 compatible – Fully tested with latest PHP versions
  • Multisite ready – Enterprise-grade permission controls
  • Secure by design – Enhanced XSS protection and attribute filtering
  • Clean uninstall – Removes all data from database on uninstall
  • Minimal database impact – Efficient storage using WordPress options and meta APIs

The PluginTests provides automated smoke tests for Head & Footer Code.

How data is stored

  • Global settings: Stored in WordPress options auhfc_settings_sitewide, auhfc_settings_homepage and auhfc_settings_article
  • Other plugin keys: auhfc_db_ver
  • Article-specific code: Stored in post meta _auhfc
  • Taxonomy-specific code: Stored in taxonomy meta _auhfc

All data is automatically removed during the uninstallation process. To preserve settings during reinstallation, deactivate (don’t uninstall), manually delete /wp-content/plugins/head-footer-code, then reinstall.

Permission levels (Multisite)

  • Global settings: Super Admin and Administrator only
  • Article-specific: Super Admin, Administrator (optionally Editor and Author)
  • Category-specific: Super Admin and Administrator only

Download

You can download the plugin below or from the official WordPress.org page for Head & Footer Code while the development version can be found in the GitHub repository urosevic/head-footer-code

Installation

Getting started with Head & Footer Code takes less than 2 minutes. Choose your preferred installation method below.

Quick start (Recommended)

  1. In your WordPress Dashboard, go to Plugins → Add New
  2. Search for head footer code
  3. Click Install Now on the Head & Footer Code plugin
  4. Click Activate
  5. Go to Tools → Head & Footer Code to start adding your code

That’s it! You’re ready to add tracking codes, analytics, or custom scripts.

Alternative installation methods

Manual upload via WordPress Dashboard

  1. Download the plugin from WordPress.org
  2. In WordPress Dashboard, go to Plugins → Add New
  3. Click Upload Plugin at the top
  4. Click Choose File and select the head-footer-code.zip file
  5. Click Install Now
  6. After installation completes, click Activate Plugin
  7. Navigate to Tools → Head & Footer Code to configure

FTP/SFTP installation

For users with direct server access:

  1. Download head-footer-code.zip from WordPress.org
  2. Extract the archive on your local computer
  3. Connect to your server via FTP/SFTP
  4. Upload the entire head-footer-code folder to /wp-content/plugins/
  5. In WordPress Dashboard, go to Plugins → Installed Plugins
  6. Find Head & Footer Code and click Activate
  7. Navigate to Tools → Head & Footer Code to configure

WP-CLI installation

For developers using command line:

wp plugin install head-footer-code --activate

How To Use?

Frequently Asked Questions

Can I use PHP code in the snippets?

No. For security reasons, Head & Footer Code does not execute PHP. All code is output exactly as entered – perfect for JavaScript, CSS, and HTML snippets.

I added code to the BODY section, but nothing appears

Your theme must support the wp_body_open hook (introduced in WordPress 5.2). If you are not sure, contact your theme developer for assistance.

Why do Editors/Authors see “Tag is not allowed” errors on multisite?

This is a WordPress security feature. Non-administrators are restricted from adding unfiltered HTML by default.

To allow Editors to add code on single sites, enable the option at the bottom of Tools → Head & Footer Code. For multisite networks, you’ll need to grant the unfiltered_html capability to the role (requires custom code or a capability manager plugin).

Where do I report security vulnerabilities?

Please report security issues through the Patchstack Vulnerability Disclosure Program. Do not post security issues in public forums.

Screenshots

What Users Say

User reviews for Head & Footer Code in Q2 2025

References

YouTube Videos

Dedicated Articles

Community

Lists of plugins

Need help?

If something isn’t working, please open a support ticket with details about your issue. We’re committed to helping you get it up and running.

Please check our FAQ section before opening a ticket to see if your question has already been answered.

If Head & Footer Code saves you time, we’d appreciate a review!