Last Updated on October 23, 2011
Better WordPress External Links
Gives you total control over external links on your website. This plugin also comes with a comprehensive domain filtering feature.
Sponsor Gazette by WooThemes - A fast magazine style theme for news websites!
The number of links on a web page, whether local or external, is most of the time huge. You post a lot of links in your post contents and your visitors also post lots of links in their comments. If a link is external, it could be better that you allow your visitors to view such link in a separate browser tab so that they won’t have to leave the current page they are reading, which is obviously on your website. This plugin offers you such functionality along with many other useful features.
- Allows you to process all links on any given page. This is an experimental feature so feedbacks are appreciated! (since 1.1.0)
- Allows you to add
rel="nofollow"or any custom relation tag you could think of to external links
- Allows you to specify CSS classes for both local and external links
- Allows you to choose whether or not to open a completely new window for each external link
- Allows you to choose between three ‘new window’ modes: onclick, target or jQuery
- Allows you to prefix external links with anything (typical use could be a redirection page that warns your visitors about the danger of visiting external sites)
- Allows you to specify which sub-domain of your website/blog to be considered local
- Allows you to specify which domains to be considered local (e.g. if you link to wordpress.org a lot you might want to force that domain local)
- Allows you to forbid some domains (e.g. pron.com, warez.com) and replace links pointing to those domains with a custom string of your own (useful for filtering links in visitors’ comments)
- WordPress Multi-site compatible (not tested with WPMU)
By default this plugin does not make links poiting to sub-domains of your website/blog external. For example
premium.plugin.betterwp.net is considered local. If you choose ‘no sub-domains’ in the ‘Ignore links pointing to’ select box, the result will be opposite, all sub-domains will then be considered external.
The usual case would be you only want some sub-domains to be considered local and that’s why we have the third option: ‘some sub-domains’. After choosing such option you must tell the plugin which sub-domains to filter out, by typing each sub-domain’s name (not the whole domain!) on a separate line in the directly below textarea. For example, you may type those sub-domains like this:
plugin theme premium.theme
theme.betterwp.net are now local while the rest, for example
photos.betterwp.net, are external domains.
To filter out a domain you would type it on a separate line just like above. The only difference is this time you will have to type the domain itself (e.g. ‘wordpress.org’) instead of just wordpress. This applies to ‘Forced local domains’ and ‘Forbidden domains’ settings.
New window (or tab) modes
There are actually two ways a new window pops up when your visitors click on an external link, that is the ‘_blank’ way and the ‘_new’ way. Basically speaking the ‘_blank’ way tries to open a new window for every external link while the ‘_new’ way will try to open just one new window for all external links (the latter’s contents will replace the former’s). BWP External Links allows you to choose the way you like, easily.
Now what about which methods will we use to actually open up a new window (tab)? The answer is either the target attribute, which is not W3 compliant, or the onclick attribute, which might get blocked, or jQuery. If you already use jQuery for other things on your website, I’d recommend that you use jQuery method, it is clean and safe .
This is actually a favourite feature of mine. The redirection page is something you often see when you click on external links warning you about the possibility of danger when you visit such links. Sites with lots of comments and links use it, for example http://www.deviantart.com/. Typically, you may use something like this: http://example.com/out.php?url=external_url, which means you prefix the external links with another URL of your choice. If you post download links in your posts you might also want to anonymize it using some 3rd-party services such as http://anonym.to, which is already available by default.
Styling your external links
With the CSS classes in hands there would be no trouble beautifying your external (or even local) links. I would just add a ‘pointing out’ icon to the end of every external link and add some ‘text-decoration’ rules if needed. You might find some icons here and a neat tutorial about this here.
That’s all for now, thanks for reading, and enjoy this plugin!
- (planned) Remove anchors pointing to forbidden domains completely rather than just the href.
- (This section is open for feature request)
BWP External Links is based on the idea of a phpBB3 mod named Prime Links © Ken F. Innes IV, also known as Prime Halo.
This plugin is licensed under GPL version 3, and it needs contributions from the community.
Buy me some special coffees!
My plugins and support for them are free. If you like my work and could buy me some (special) coffees, I would be much appreciated! They might help with some overnight times debugging my plugins, you know.
Support, Feedback, and Code Improvement
- Please report bugs to the BWP Community.
- WordPress Plugin Repository: http://wordpress.org/extend/plugins/bwp-external-links/ (please vote for this plugin if you like it, thanks!)
i18n (Translate the plugin)
If you are a translator, please help translating this plugin. Even if you aren't, you can become one, it is very easy and fun! If you want to know how, please read here: Create a .pot or .po File using Poedit.