Linking to external resources in your WordPress posts and pages might sound counterintuitive to your search engine optimization efforts. If you want readers to stay on your site, then it doesn’t make much sense to point them to others — or does it?

Linking to high-quality external websites and blogs is actually important to your site’s SEO and to your readers. First, it’s an important element of any link building strategy. When you link to other sites in a consistent and strategic way, then one of those site owners is likely to return the favor. These backlinks are crucial to your SEO efforts since they are one of the most important ranking factors for major search engines. Google, for example, counts backlinks among the top eight factors.

Linking to high-quality external resources is also important to your content strategy. You can’t cover every aspect of a topic in one post — and you shouldn’t try. Instead, you can leverage the wealth of information available on the web by providing external links in your content. This will help you provide as much information to your readers as possible, which will ultimately give them a better experience on your site.

Use HubSpot tools on your WordPress website and connect the two platforms  without dealing with code. Click here to learn more.

There’s just one potential pitfall. If you don’t set these links to open in a new tab or window, then readers will be redirected to the external site or blog and might not come back to yours. With readers spending less time on your site, your bounce rate will increase, which can negatively impact your rankings on search engines.

Setting these links to open in a new tab or window is a simple solution. That way, you provide readers with additional resources without directing them away from the post or page they’re reading.

In this post, we’ll look at how you can manually set external links to open in a new tab or window in WordPress. Then, we’ll cover how you can use code or a plugin to automate the process. Let’s look at these different methods below.

How to Manually Open External Links in a New Window

You can easily set external links to open in a new tab in WordPress. In the Classic Editor, just insert your link and click Link Options to open the advanced insert link popup. Then check the box labeled “Open link in a new tab.”

In Classic Editor, click the gear icon to open Link Options and set external link to open in a new tab

The process is nearly identical in the Gutenberg Editor. You just click Link Settings and toggle on the “Open in New Tab” slider.

In Gutenberg editor, click Link Settings and toggle on the "Open in New Tab" slider

Source

In both editors, the process is easy. The issue is it doesn’t scale well. You may produce a large volume of content and forget a link here or there. Or you may run a multi-author site and have trouble hardwiring this best practice into your writers’ and freelancers’ workflows. In either case, you would benefit from an automated solution for setting your external links to open in a new tab or window.

Let’s look at how you can use code to automatically set external links to open in a new tab or window.

How to Automatically Open External Links in a New Window Using Code

You can add a code snippet to your theme’s footer.php file to automatically open external links on your site in a new window. Just navigate to Appearance > Editor in your WordPress dashboard. Then click on the footer.php file to open it. Scroll down until you see the body and HTML closing tags.

Add a code snippet to your theme’s footer.php file before the body and HTML closing tags to automatically open external links on your site in a new window

Source

Copy and paste the following code before the body and HTML closing tags.

 

 

   <script type="text/javascript">

//<![CDATA[

jQuery(document).ready(function($) {

$('a').each(function() {

var a = new RegExp('/' + window.location.host + '/');

if(!a.test(this.href)) {

$(this).click(function(event) {

event.preventDefault();

event.stopPropagation();

window.open(this.href, '_blank');

});

}

});

});

//]]>

</script>

Once you save your changes, all external links in your published posts and pages will open in a new tab. This code will also work for new posts and pages.

This code does not work for internal links or for links in comments or text widgets, however. If you’d like to set all links anywhere on your site to open in new tabs, then you can use a plugin.

Plugins to Automatically Open External Links in a New Window

Plugins are the fastest and most flexible option for setting links to open in a new tab or window. Let’s look at two options below.

External Links in New Window / New Tab

External Links in New Window / New Tab by WebFactory Ltd is a free WordPress plugin that automatically sets all external links to open in a new window. It begins working as soon as you install and activate it.

There is a settings page for turning the functionality on or off for specific links if you want more control.

In the External Links in New Window / New Tab plugin setting, you can turn the auto-setting on and off for specific links

Source

External Links – nofollow, noopener & new window

For more control in configuring your link settings, you can use External Links – nofollow, noopener & new window. This is another free plugin by WebFactory Ltd.

After installing and activating this plugin, you can set different options for external and internal links in your WordPress dashboard. You can display an icon after external links to indicate to readers which links are pointing to other websites. It may look like this in your published post.

Published WordPress post with an icon displayed next to a link to 9GAG's site

Source

You can also automatically set all external links on your site to “nofollow.” This tag tells search engines not to follow these links and associate them with your site’s rankings. This is recommended for newer sites that may not be earning many inbound links. Why? Because sites that are linking out more often than they are getting linked to are looked on less favorably by search engines.

Automatically set external links to "nofollow" in the External Links – nofollow, noopener & new window plugin settings

Source

Following this tutorial, you can manually or automatically set your external links to open in a new tab or window. Doing so will help reduce your site’s bounce rate and provide your visitors with better experiences.

Wordpress Plugin HubSpot

 Use HubSpot tools on your WordPress website and connect the two platforms  without dealing with code. Click here to learn more.

Originally published Nov 22, 2019 11:07:13 AM, updated November 22 2019

Topics:

WordPress Website