WordPress.org

Plugin Directory

WP External Links (nofollow new window seo)

Open external links in a new window or tab, adding "nofollow", set link icon, styling, SEO friendly options and more. Easy install and go.

How to treat internal links as external links?

You could add rel="external" to those internal links that should be treated as external. The plugin settings will also be applied to those links.

Why are links to my own domain treated as external links?

Only links pointing to your WordPress site (wp_url) are internal links. All other links will be treated as external links.

How to treat links to subdomains as internal links?

Add your main domain to the option "Ingore links (URL) containing..." and they will not be treated as external.

How to create a redirect for external links?

By using the wpel_external_link filter. Add this code to functions.php of your theme:

function redirect_external_link($created_link, $original_link, $label, $attrs = array()) {
    $href = $attrs['href'];

    // create redirect url
    $href_new = get_bloginfo('wpurl') . '/redirect.php?url=' . urlencode($attrs['href']);

    return str_replace($href, $href_new, $created_link);
}

add_filter('wpel_external_link', 'redirect_external_link', 10, 4);

Set a font icon for external links, like [Font Awesome Icons](http://fortawesome.github.io/Font-Awesome/)?

Use the wpel_external_link filter and add this code to functions.php of your theme:

function set_font_icon_on_external_link($created_link, $original_link, $label, $attrs = array()) {
    $label_with_font = $label . ' <i class="fa fa-external-link"></i>';
    return str_replace($label, $label_with_font, $created_link);
}

add_filter('wpel_external_link', 'set_font_icon_on_external_link', 10, 4);

The CSS of Font Awesome Icons alse needs to be loaded. To do so also add this code:

function add_font_awesome_style() {
    wp_enqueue_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css');
}

add_action('wp_enqueue_scripts', 'add_font_awesome_style');

How to open external links in popup browser window with a certain size?

By adding this JavaScript code to your site:

jQuery(function ($) {

    $('a[rel*="external"]').click(function (e) {
        // open link in popup window
        window.open($(this).attr('href'), '_blank', 'width=800, height=600');

        // stop default and other behaviour
        e.preventDefault();
        e.stopImmediatePropagation();
    });

});

See more information on the window.open() method.

How to add an confirm (or alert) when opening external links?

Add this JavaScript code to your site:

jQuery(function ($) {

    $('a[rel*="external"]').click(function (e) {
        if (!confirm('Are you sure you want to open this link?')) {
            // cancelled
            e.preventDefault();
            e.stopImmediatePropagation();
        }
    });

});

How to make all internal links "follow"?

By using the wp_internal_link filter. Add this code to functions.php of your theme:

function set_follow_to_internal_link($link, $label, $attrs) {
    return str_replace('nofollow', 'follow', $link);
}

add_filter('wpel_internal_link', 'set_follow_to_internal_link', 10, 3);

Do you have a question? Please ask me

Requires: 3.4.0 or higher
Compatible up to: 4.1.1
Last Updated: 2015-2-23
Active Installs: 20,000+

Ratings

4.2 out of 5 stars

Support

1 of 3 support threads in the last two months have been resolved.

Got something to say? Need help?

Compatibility

+
=
Not enough data

3 people say it works.
0 people say it's broken.

100,1,1 100,1,1 100,1,1 100,2,2 100,1,1 50,2,1
100,1,1 0,1,0 100,3,3
0,1,0 100,2,2 38,8,3
50,2,1
50,2,1 60,5,3
0,3,0 100,3,3 50,2,1
100,2,2
100,2,2
100,3,3
67,3,2 100,1,1
33,3,1 100,1,1 100,1,1 100,4,4
100,2,2
100,1,1
100,2,2
100,1,1 100,2,2
100,3,3
0,1,0 100,1,1
100,1,1
100,1,1
100,1,1 100,1,1 100,1,1 100,3,3
100,1,1
100,1,1 100,3,3
100,1,1 100,2,2
100,3,3