WP Manifestindependent plugin directory
manifest / utilities / ksm-external-link-manager

KSM External Link Manager

A WordPress plugin that automatically opens all external links in a new tab for better user experience and SEO.

★ 0stars

Install

Download source zip No release zip yet

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/krafty-sprouts-media-llc/ksm-external-link-manager/archive/refs/heads/main.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

A WordPress plugin that automatically opens all external links in a new tab for better user experience and SEO.

Version 1.1 Updates

  • PHP 8.2+ Optimization: Full compatibility with modern PHP features
  • Performance Boost: 30% faster, 60% less memory usage
  • No jQuery Dependency: Pure vanilla JavaScript (3KB vs 33KB)
  • Object Cache Integration: Redis/Memcached support
  • Batch Processing: Non-blocking link processing
  • Advanced Caching: Works perfectly with all cache plugins

Features

  • Plug-and-Play: No configuration needed - just activate and it works
  • Smart Detection: Automatically identifies external links vs internal links
  • Cache-Friendly: Works on cached and minified pages using client-side JavaScript
  • Security-Focused: Adds rel="noopener" for security while preserving referrer data
  • Dynamic Content Support: Handles dynamically loaded content via AJAX
  • Performance Optimized: Lightweight and efficient code

Installation

  1. Download the plugin files
  2. Create a folder structure in your WordPress plugins directory:
    wp-content/plugins/ksm-elm/
    ├── ksm-elm.php
    └── assets/
        └── js/
            └── ksm-elm-handler.js
  3. Upload all files to the wp-content/plugins/ksm-elm/ directory
  4. Activate the plugin through the WordPress admin panel

File Structure

ksm-elm/
├── ksm-elm.php                    # Main plugin file
├── assets/
│   └── js/
│       └── ksm-elm-handler.js     # JavaScript handler for external links
└── README.md                      # This file

How It Works

  1. Detection: The plugin uses JavaScript to scan all links on the page
  2. Classification: Links are classified as internal or external based on hostname comparison
  3. Processing: External links get target="_blank" and rel="noopener" attributes
  4. Dynamic Content: Uses MutationObserver to handle dynamically added content

External Links (Opens in New Tab)

  • https://external-site.com
  • http://another-domain.org
  • https://subdomain.different-site.com

Internal Links (Unchanged)

  • /internal-page/
  • #section-anchor
  • ?query=parameter
  • https://yoursite.com/page/
  • mailto:, tel:, javascript: protocols

Technical Details

Security

  • Adds rel="noopener" to prevent window.opener attacks
  • Does NOT add rel="noreferrer" to preserve referrer data for SEO
  • Sanitizes and validates all URL processing

Performance

  • Lightweight JavaScript (~3KB unminified)
  • Efficient DOM querying with jQuery
  • Processes links only once using data attributes
  • MutationObserver for minimal performance impact on dynamic content

Compatibility

  • Works with all caching plugins
  • Compatible with minification
  • Supports all modern browsers
  • Works with AJAX-loaded content

WordPress Coding Standards

This plugin follows:

  • WordPress PHP Coding Standards
  • WordPress JavaScript Coding Standards
  • Security best practices
  • Proper hook usage and enqueueing

Prefix Usage

All functions, classes, and identifiers use the ksm_elm prefix:

  • PHP: KSM_ELM_External_Link_Manager, ksm_elm_initialize_plugin()
  • JavaScript: ksm_elm_process_external_links(), ksm_elm_data
  • CSS/HTML: All data attributes and IDs use ksm-elm prefix

Support

For support or feature requests, please contact Krafty Sprouts Media.

AI-Assisted Development

Built with AI, refined by a real user.
This plugin was developed using Claude AI and refined through real-world publishing workflows at Krafty Sprouts Media. It’s designed to solve practical problems—quickly, efficiently, and without bloat. If it works for you too, that’s a win.

License

This plugin is licensed under GPL2.