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.

Documentation

After activating the plugin all options are already set to make your external links SEO friendly. Optionally you can also set the target for opening in a new window or tab or styling options, like adding an icon.

Action hook: wpel_ready

The plugin also has a hook when ready, f.e. to add extra filters:

function extra_filters($filter_callback, $object) {
    add_filter('some_filter', $filter_callback);
}

add_action('wpel_ready', 'extra_filters');

Filter hook 1: wpel_external_link

The wpel_external_link filter gives you the possibility to manipulate output of all external links, like:

add_filter('wpel_external_link', 'wpel_special_external_link', 10, 5);

function wpel_special_external_link($created_link, $original_link, $label, $attrs, $is_ignored_link) {
    // skip links that contain the class "not-external"
    if (isset($attrs['class']) && strpos($attrs['class'], 'not-external') !== false) {
        return $original_link;
    }

    return '<b>'. $created_link .'</b>';
}

Now all external links will be processed and wrapped around a <b>-tag. And links containing the class "not-external" will not be processed by the plugin at all (and stay the way they are).

Filter hook 2: wpel_external_link_attrs

The wpel_external_link_attrs filter can be used to manipulate attributes of external links.

add_filter('wpel_external_link_attrs', 'wpel_custom_title', 10, 3);

function wpel_custom_title($attrs, $original_attrs, $label) {
    if (empty($attrs['title']) && isset($attrs['href'])) {
        $attrs['title'] = $attrs['href'];
    }

    return $attrs;
}

In this example when an external links has an empty title, the title will contain the url.

Filter hook 3: wpel_ignored_external_link

With the wpel_ignored_external_link filter you can manipulate the output of the ignored external links.

add_filter('wpel_ignored_external_link', 'wpel_custom_ignored_link', 10, 3);

function wpel_custom_ignored_link($link, $label, $attrs) {
    return '<del>'. $link  .'</del>';
}

In this case all ignored links will be marked as deleted (strikethrough).

Filter hook 4: wpel_internal_link

With the wpel_internal_link filter you can manipulate the output of all internal links on your site. F.e.:

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

function special_internal_link($link, $label, $attrs) {
    return '<b>'. $link  .'</b>';
}

In this case all internal links will be made bold.

See FAQ for more possibilities of using these filters.

Credits

Requires: 3.6.0 or higher
Compatible up to: 4.2.4
Last Updated: 2015-7-23
Active Installs: 20,000+

Ratings

4.2 out of 5 stars

Support

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

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 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 0,1,0 100,1,1
60,5,3 100,2,2