WordPress.org

Plugin Directory

WP External Links (nofollow new tab seo)

Open external links in a new tab / window, add "nofollow", "noopener" and font icons, SEO and more. Also for internal links.

Documentation

After activating you can set all options for external and internal links.

Data attribute "data-wpel-link"

Links being processed by this plugin will also contain the data-attribute data-wpel-link. The plugin could set the value to external, internal or exclude, meaning how the link was processed.

You can also set the data-attribute yourself. This way you can force how the plugin will process certain links.

When you add the value ignore, the link will be completely ignored by the plugin:

<a href="http://somedomain.com" data-wpel-link="ignore">Go to somedomain</a>

Action "wpel_link"

Use this action to change the link object after all plugin settings have been applied.

add_action( 'wpel_link', ( $link_object ) {
    if ( $link_object->is_external() ) {
        // get current url
        $url = $link_object->getAttribute( 'href' );

        // set redirect url
        $redirect_url = '//somedom.com?url='. urlencode( $url );
        $link_object->setAttribute( 'href', $redirect_url );
    }
}, 10, 1 );

The link object is an instance of WPEL_Link class.

Action hook "wpel_before_apply_link"

Use this action to change the link object before the plugin settings will be applied on the link. You can use this filter f.e. to ignore individual links from being processed. Or change dynamically how they will be treated by this plugin.

add_action( 'wpel_before_apply_link', function ( $link ) {
    // ignore links with class "some-cls"
    if ( $link->has_attr_value( 'class', 'some-cls' ) ) {
        $link->set_ignore();
    }

    // mark and treat links with class "ext-cls" as external link
    if ( $link->has_attr_value( 'class', 'ext-cls' ) ) {
        $link->set_external();
    }
}, 10 );

Filter hook "wpel_apply_settings"

When filter returns false the plugin settings will not be applied. Can be used when f.e. certain posts or pages should be ignored by this plugin.

add_filter( 'wpel_apply_settings', '__return_false' );

See FAQ for more info.

Requires: 4.2.0 or higher
Compatible up to: 4.5.3
Last Updated: 1 month ago
Active Installs: 20,000+

Ratings

4.4 out of 5 stars

Support

16 of 27 support threads in the last two months have been marked 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 100,1,1
0,1,0
100,2,2
100,3,3
100,2,2
100,1,1 100,1,1
100,1,1 100,2,2 100,1,1 100,1,1 100,1,1 33,3,1 67,3,2 100,2,2