Affiliate Link Injector WP Registry grade A. No security issues foundWP RegistryNo security issues foundOpen the reportA
WordPress plugin that automatically appends affiliate tracking parameters to links targeting specific domains
Install
Upload it under Plugins → Add New Plugin → Upload Plugin, then activate.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/danieliser/affiliate-link-injector/releases/download/1.0.3/affiliate-link-injector-1.0.3.zipAutomatically appends affiliate tracking parameters to links targeting specific domains across all WordPress content contexts.
Features
- Rule-based injection - Define rules by target domain with query params (
?ref=123) or path format (/ref/123) - Universal content support - Works with Gutenberg blocks, Bricks Builder, Classic Editor, widgets, comments, excerpts, and REST API responses
- Smart duplicate detection - Prevents double-appending of affiliate parameters
- Subdomain matching - Optionally match subdomains (e.g.,
docs.example.com) - Path exclusions - Skip specific paths from injection
- Modern admin UI - React-based rule management with inline editing
Requirements
- WordPress 6.2+
- PHP 8.0+
Installation
Via GitHub Release
- Download the latest release zip from Releases
- Upload to WordPress via Plugins → Add New → Upload Plugin
- Activate the plugin
Via Git Updater
This plugin supports Git Updater for automatic updates.
Configuration
Navigate to Settings → Affiliate Links to manage rules.
Rule Options
| Field | Description |
|---|---|
| Label | Display name for the rule |
| Domain | Target domain (e.g., example.com) |
| Format | query for ?param=value or path for /path/segment |
| Query Params | Key-value pairs for query format |
| Affiliate Path | Path segment for path format |
| Include Subdomains | Match subdomains of the target domain |
| Excluded Paths | Paths to skip (e.g., /docs, /support) |
| Enabled | Toggle rule on/off |
Example Rules
Query format:
- Domain:
example.com - Format:
query - Params:
ref=123 - Result:
https://example.com/page→https://example.com/page?ref=123
Path format:
- Domain:
example.com - Format:
path - Path:
ref/456 - Result:
https://example.com/page→https://example.com/ref/456/page
REST API
The plugin exposes a REST API at /wp-json/affiliate-link-injector/v1/:
| Endpoint | Method | Description |
|---|---|---|
/rules |
GET | List all rules |
/rules |
POST | Create a rule |
/rules/{id} |
GET | Get a rule |
/rules/{id} |
PATCH | Update a rule |
/rules/{id} |
DELETE | Delete a rule |
/rules/{id}/toggle |
POST | Toggle rule enabled |
/settings |
GET/POST | Manage settings |
/health |
GET | Health check |
/export |
GET | Export rules |
/import |
POST | Import rules |
Hooks
Skip Processing
add_filter( 'affiliate_link_injector/skip_processing', function( $skip ) {
// Skip on specific pages
if ( is_page( 'no-affiliate' ) ) {
return true;
}
return $skip;
});
Exclude Links by Class
Add the class no-affiliate to any link to exclude it from processing:
<a href="https://example.com" class="no-affiliate">Not tracked</a>
Development
Run Tests
# PHP Unit Tests
composer install
TEST_TYPE=unit ./vendor/bin/phpunit
# JavaScript Tests
npm install
npm test
# PHPCS
./vendor/bin/phpcs
Build Admin UI
npm install
npm run build
Changelog
See CHANGELOG.md for version history.
License
GPL-2.0-or-later
Releases
4 releases. Each count is every asset in that release; expand a row for the breakdown.