Code Injector Elite self-updates
Professional code injection plugin for WordPress. Inject custom HTML, JavaScript, and CSS into page headers and footers with precision and control.
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/a5ah1/code-injector-elite/archive/refs/heads/master.zipShips its own WordPress updater (Plugin Update Checker), so new versions show up under Dashboard → Updates.
Professional code injection plugin for WordPress. Inject custom HTML, JavaScript, and CSS into page headers and footers with precision and control.
Features
-
Two-Tier Injection System
- Global code: Applied site-wide to every page
- Page-specific code: Applied to individual posts or pages only
-
Flexible Control
- Enable/disable code injection for posts and pages independently
- Non-destructive - disabling preserves your data
-
CodeMirror Integration
- Syntax highlighting for HTML, JavaScript, and CSS
- The same professional editor used in WordPress Theme Editor
-
Advanced Tools
- Usage reports to track which pages have custom code
- Bulk data deletion with progress tracking
- Legacy data migration tool
-
Security-Conscious
- Capability checks (admin and editor only)
- CSRF protection with nonces
- PHP tag removal
Installation
From GitHub
- Download the latest release from the Releases page
- Upload the
code-injector-elitefolder to/wp-content/plugins/ - Activate the plugin through the 'Plugins' menu in WordPress
- Navigate to Settings → Code Injector Elite to configure
Manual Installation
- Clone this repository into your WordPress plugins directory:
cd wp-content/plugins git clone https://github.com/a5ah1/code-injector-elite.git - Activate the plugin through the 'Plugins' menu in WordPress
Usage
Global Code Injection
- Go to Settings → Code Injector Elite
- Navigate to the Settings tab
- Add your code in the Header Code or Footer Code fields:
- Header code injects into
<head>section - Footer code injects before closing
</body>tag
- Header code injects into
- Click Save and Deploy Code
Use cases:
- Google Analytics or tracking scripts
- Site-wide custom CSS
- Third-party integrations (chat widgets, etc.)
- Custom meta tags
Page-Specific Code Injection
- Edit any post or page
- Scroll to the Code Injector Elite meta box
- Add your custom code in the Header Code or Footer Code fields
- Publish or update the page
Use cases:
- Landing page specific tracking
- Custom styles for individual pages
- Page-specific JavaScript functionality
- A/B testing scripts
Enable/Disable for Post Types
- Go to Settings → Code Injector Elite → Settings tab
- Under Plugin Activation, check/uncheck:
- Enable for Posts - Show meta boxes on post edit screens
- Enable for Pages - Show meta boxes on page edit screens
- Click Save Activation Settings
Requirements
- WordPress: 5.2 or higher
- PHP: 7.2 or higher
- User Capabilities:
manage_optionsfor global settings,edit_postfor page-specific code
Automatic Updates
This plugin supports automatic updates via GitHub! When a new version is released, you'll receive an update notification in your WordPress admin just like plugins from the WordPress.org repository.
To receive updates:
- Ensure your WordPress site can connect to GitHub (most hosting environments allow this)
- Check for updates in Dashboard → Updates or Plugins → Installed Plugins
Documentation
Plugin Structure
code-injector-elite/
├── code-injector-elite.php # Main plugin file
├── includes/ # Core classes
│ ├── constants.php # Plugin constants
│ ├── class-plugin.php # Main plugin class
│ ├── class-assets.php # Asset management
│ ├── class-settings.php # Settings page
│ ├── class-meta-boxes.php # Post/page meta boxes
│ ├── class-frontend.php # Frontend code injection
│ ├── class-migration.php # Data migration tools
│ └── class-data-tools.php # Usage reports & bulk deletion
├── views/ # Template files
│ ├── settings-page.php # Settings page template
│ └── meta-box.php # Meta box template
├── css/ # Stylesheets
├── js/ # JavaScript files
└── uninstall.php # Uninstall cleanup
Developer Hooks
The plugin uses standard WordPress hooks:
plugins_loaded- Plugin initializationadmin_menu- Settings page registrationadd_meta_boxes- Meta box registrationsave_post- Meta box data savingwp_head- Header code injectionwp_footer- Footer code injection
Security
This plugin is designed for trusted administrators and follows a trust-based security model:
What's Protected:
- Capability checks ensure only admins and editors can inject code
- CSRF protection via nonces
- PHP tags are stripped (they wouldn't execute anyway)
What's Intentionally Allowed:
- HTML, JavaScript, and CSS injection (by design)
- Inline scripts and styles
- External resource loading
Important: Only grant access to users you trust. This plugin is designed for DIY users who need direct code injection capabilities.
Migration from Legacy Versions
If you're upgrading from an older version using attr_* field names:
- Go to Settings → Code Injector Elite → Migration tab
- Click the detection buttons to scan for legacy data
- Review the detected items
- Click Migrate to transfer data to the new format
- Legacy data is automatically removed after successful migration
Data Management
Usage Reports
View which posts and pages have custom code:
- Navigate to Data Tools tab
- Click Check Posts Usage or Check Pages Usage
- View detailed report with edit links
Bulk Deletion
Permanently remove all code injection data:
- Navigate to Data Tools tab
- Scroll to Bulk Data Deletion section
- Follow the prompts (requires typed confirmation)
Changelog
See CHANGELOG.md for version history and updates.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Support
- Issues: GitHub Issues
- Documentation: This README and inline code documentation
License
This project is licensed under the MIT License - see the LICENSE file for details.
Author
a5ah1
- GitHub: @a5ah1
Note: This plugin intentionally allows raw HTML/JS/CSS injection for maximum flexibility. It's designed for users who understand code and need direct control over their site's markup.