Script Injector
Lightweight WordPress plugin that allows you to easily insert custom scripts (like Google Analytics, Facebook Pixel, Google Tag Manager, etc.) into your website's header, body, or footer.
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/wp-fuse/script-injector/archive/refs/heads/main.zipDeclares an update source (https://github.com/wp-fuse/script-injector), so updates arrive through the plugin's own updater.
Readme
Script Injector
Script Injector is a lightweight WordPress plugin that allows you to easily insert custom scripts (like Google Analytics, Facebook Pixel, Google Tag Manager, etc.) into your website's header, body, or footer.
Features
- Header Scripts: Insert scripts into the
<head>section of your site. - Body Scripts: Insert scripts immediately after the opening
<body>tag. - Footer Scripts: Insert scripts into the
<footer>section of your site. - Permission Check: Only users with
manage_optionscapability can access the settings page. - Clean Execution: Scripts are injected using standard WordPress hooks (
wp_head,wp_body_open,wp_footer).
Performance
This plugin is engineered for minimal overhead:
- Admin/front-end code isolation: Admin code (settings, menus, rendering) is never loaded on public pages.
- Single DB query: Only one
get_optioncall per request on the front-end. - Early bail-out: If no scripts are configured, the plugin exits immediately — zero hooks registered.
- Conditional hooks: Only hooks for non-empty script fields are registered.
- Zero global functions: All logic uses closures, avoiding namespace pollution.
Installation
- Upload the
script-injectorfolder to the/wp-content/plugins/directory. - Activate the plugin through the 'Plugins' menu in WordPress.
- Access the settings via Settings → Scripts.
How to use
- Go to the Scripts settings page.
- Paste your script code (e.g., ``) into the corresponding field (Header, Body, or Footer).
- Click "Save Changes".
Requirements
- WordPress 5.2+ (for
wp_body_opensupport) - PHP 7.0+
Read the full README on GitHub →
Releases
| Tag | Published |
|---|---|
| v1.2.0 | Mar 23, 2026 |
These releases are tags only. The author does not attach a packaged zip, so there are no download counts to report.