Insert Header Footer & Body Code
WordPress plugin for inserting header, body, and footer code snippets, schema markup, JSON-LD, analytics scripts, SEO tags, and AI search optimization integrations.
by Wajid Ali Tabassum · github.com/wajidalitabassum143/insert-header-footer-body-code · 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/wajidalitabassum143/insert-header-footer-body-code/archive/refs/heads/main.zipInsert Header Footer & Body Code is a lightweight WordPress plugin for inserting custom header, body, and footer code snippets, structured data, schema markup, analytics scripts, verification tags, and body classes without editing theme files.
The plugin is useful for SEO, AEO (Answer Engine Optimization), GEO (Generative Engine Optimization), Google Tag Manager, analytics integrations, JSON-LD schema insertion, custom tracking scripts, and AI search optimization workflows.
SEO, AEO & GEO Use Cases
This plugin can be used to:
- insert SEO verification tags
- add JSON-LD structured data
- inject schema markup
- add Google Analytics and Google Tag Manager scripts
- manage custom tracking snippets
- support AI search and generative engine optimization workflows
- customize body classes for advanced CSS targeting
Project Status
This repository is prepared for a public first release and ongoing maintenance as an open-source WordPress plugin project.
Why This Plugin Is Useful
This plugin was originally built with advanced conditional insertion controls and body class management in mind. It gives site administrators a practical way to:
- insert site-wide header, body, and footer code
- add conditional code to specific posts, pages, and custom post types
- add conditional code to taxonomy term archive views
- attach custom body classes to selected items and terms
That makes it useful for analytics snippets, verification tags, structured data, CSS targeting, campaign-specific scripts, and similar controlled front-end changes.
Key Features
- Global header, body, and footer code fields
- Conditional post type enablement for per-item code fields
- Conditional post type enablement for per-item custom body class fields
- Conditional taxonomy enablement for term-level code fields
- Conditional taxonomy enablement for term-level custom body class fields
- Native WordPress settings screens, meta boxes, and term fields
- Body class sanitization into valid CSS class tokens
- Raw snippet handling reserved for users with the
unfiltered_htmlcapability
Installation
End-user plugin ZIP
- Download a clean release ZIP.
- In WordPress admin, go to
Plugins > Add New > Upload Plugin. - Upload the ZIP and activate the plugin.
- Open
Settings > Header Footer Body Code.
Development checkout
- Clone this repository.
- Place the plugin folder inside your local WordPress
wp-content/plugins/directory, or symlink it there if you prefer. - Activate the plugin in your local WordPress installation.
- Run tests locally before making changes.
Development
The plugin is intentionally kept lightweight and WordPress-native.
Development-oriented files may exist in this source repository, including:
tests/composer.jsoncomposer.lockphpunit.xml.dist.phpcs.xml.dist
These files help maintain the project, but they are not required in the end-user plugin ZIP.
Testing
PHPUnit is configured for lightweight utility and settings tests.
Requirement:
- Composer installed locally
Run tests on Windows
If you are already inside the plugin directory:
composer install
vendor\bin\phpunit --configuration phpunit.xml.dist
Or:
composer install
composer test
If you want to run the commands from another location:
Set-Location "path\to\insert-header-footer-body-code"
composer install
vendor\bin\phpunit --configuration phpunit.xml.dist
Or:
Set-Location "path\to\insert-header-footer-body-code"
composer install
composer test
Run tests on macOS or Linux
cd /path/to/insert-header-footer-body-code
composer install
vendor/bin/phpunit --configuration phpunit.xml.dist
Release and Packaging Notes
This GitHub repository is intended to be development-friendly.
For a clean end-user plugin ZIP, include only the runtime plugin files such as:
insert-header-footer-body-code.phpreadme.txtuninstall.phpincludes/languages/
Exclude development files from the release ZIP, including:
tests/composer.jsoncomposer.lockphpunit.xml.dist.phpcs.xml.distvendor/- local logs, caches, and temporary build files
See RELEASE.md for a concise release checklist.
License
This project is licensed under the GNU General Public License, version 2.0 or later.
See LICENSE for details.