Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/wp-fuse/script-injector/archive/refs/heads/main.zipNo built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.
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+
Releases
1 release.
Tag
Published
v1.2.0
latest
Mar 23, 2026 7mo ago
These releases are tags only. The author does not attach a packaged zip, so there are no download counts to report.