CV Simple Header Footer Scripts
Lightweight, secure WordPress plugin to inject Header, Body, and Footer scripts (GA4, GTM, Meta Pixel, custom CSS/JS) — theme & builder agnostic, zero database bloat, built on the WordPress Settings API.
by CV Infotech · github.com/cvinfotech/cv-header-footer-scripts · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/cvinfotech/cv-header-footer-scripts/archive/refs/heads/main.zipReadme
CV Simple Header Footer Scripts
A lightweight, secure, theme & builder agnostic way to inject Header, Body, and Footer scripts into WordPress — no theme editing required.
Overview
CV Simple Header Footer Scripts gives WordPress admins three clean fields — Header, Body, and Footer — and injects whatever is pasted into them at exactly the right point in the page, using WordPress's own wp_head, wp_body_open, and wp_footer hooks.
No theme file edits. No child theme required. No plugin-specific shortcodes to remember. It works the same way on every properly-coded WordPress theme and page builder.
Settings > CV Header Footer — the plugin's admin screen, with CodeMirror-highlighted code fields.
Why This Plugin
| 🧩 Theme & builder agnostic | Built purely on core WordPress hooks — works identically with Elementor, Divi, Astra, Oxygen, Bricks, and Gutenberg/block themes. |
| 🪶 Ultra lightweight | One admin screen, one database row, zero front-end assets beyond the code you add yourself. |
| 🔐 Security-first | Settings API only, verified nonces, manage_options capability checks, and a restrictive custom wp_kses() allow-list. |
| 🗄️ Zero database bloat | All three fields are stored in a single serialized wp_options row — one query, not three. |
| 🧑💻 Developer-friendly | Strict OOP, fully PHPDoc'd, WPCS-compliant, linted in CI on every push. |
| 🧹 Clean uninstall | Deleting the plugin removes its one option — nothing left behind in your database. |
Features
- Three dedicated fields: Header (
</head>), Body (wp_body_open), Footer (</body>) - Syntax-highlighted code editor (WordPress core's bundled CodeMirror — no extra JS libraries shipped)
- One-click Settings link on the Plugins list screen
- Works out of the box with Google Analytics, Google Tag Manager, Meta Pixel, Search Console verification tags, custom CSS/JS, chat widgets, and more
- Single consolidated database option for maximum performance
- Fully translatable (
Text Domain: cv-header-footer-scripts)
Installation
From this repository
- Download or clone this repository.
- Zip the plugin folder, or copy it directly into
wp-content/plugins/cv-header-footer-scripts/. - In wp-admin, go to Plugins, find CV Simple Header Footer Scripts, and click Activate.
- Go to Settings > CV Header Footer to add your scripts.
Via Composer (for development)
git clone https://github.com/cvinfotech/cv-header-footer-scripts.git
cd cv-header-footer-scripts
composer install
composer install pulls in dev-only tooling (PHPCS + WordPress Coding Standards) — it is not required to run the plugin.
Usage
| Field | Hook | Typical use |
|---|---|---|
| Header | wp_head (priority 999) |
Meta tags, site verification codes, scripts that must load early (e.g. the GTM container ` |