WP External Links (nofollow new window seo)
[resolved] exclusions for target (3 posts)

  1. nata-lee
    Posted 1 year ago #

    Hi. I need to make an exclusion for targeting some external links. I tried to use Set no-icon class setting (I have no-ext-icon class) with "Always open links with no-icon class in same window or tab" checkbox, but it doesn't seem to work.

    I want to exclude links with images which open with fancybox.

    You can find an example here: http://valvetimes.com/4422-nenavizhu-vsyo-dota-2-chast-pervaya/#comment-100003777

    I also use such plugins as http://wordpress.org/plugins/easy-fancybox/ and wp-united http://wordpress.org/plugins/wp-united/
    I have an external links plugin for phpbb, but even if I turn it off, images open in _blank window until I turn wp-external-links off.

    Also there is a filter to exclude external links by code and css class (http://wordpress.org/support/topic/set-up-exclusion-by-code). I tried to use it too, it changes rel-attribute, but still opens links in _blank window.

    "Always open links with no-icon class in same window or tab" setting is doesn't seem to work.
    It would be very nice to have an exclusion for targeting by css class and separated from no-icon class.


  2. freelancephp
    Plugin Author

    Posted 1 year ago #

    Hello Nata-lee,

    The link (of your example) contains a target="_none". This is not set by the WPEL plugin. The plugin removes this attribute of the link, because it does not work in browsers (and it will open in a new tab).

    Maybe the target="_none" is set by another plugin? (fancybox, phpbb)

    A workaround could be by using the filter (with a very high priority number):

    function external_link_filter($created_link, $original_link, $label, $attrs = array()) {
    	// remove target="_none"
    	return preg_replace('/\s*target\s*=\s*(["\'])_none\1/', '', $created_link);
    add_filter('wpel_external_link', 'external_link_filter', <strong>1000000</strong>, 4);
  3. nata-lee
    Posted 1 year ago #

    Thank you for reply.
    target="_none" was a part of phpbb bbcode, I cut it off. But it didn't help and I was upset until I changed wp-external-links to open external links in _none and then change it back to _blank. And I got it work. It was a kind of glitch, I think.

    Thank you.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic


No tags yet.