Using links on your website is very important. But when someone clicks on an external link, they leave your website and go to another website. You don’t want your visitor to leave your site. That’s why it’s better to have such links open in a new window.
In this easy guide, we’ll show you how to open such links in a new window on your WordPress website. We’ll show you simple steps by step like using the WordPress editor, making some HTML changes, using menu settings, installing a plugin, or using a little code.
Want to stay ahead with AI-driven in WordPress insights and stay updated with the latest trends? Subscribe for daily search insights at wpguidepro.com to improve your WordPress strategy.
Table of Contents
Why Open External Links in a New Window or Tab?
When you open an external link in a new tab, the user experience is better and the visitor stays connected to your website. Doing this is beneficial.
- The first advantage is that the visitor stays on your website and can also view another site at the same time.
- The second advantage is that it is easy to switch between tabs. There is no need to go back again and again.
- The third advantage is that your website looks professional. People think that your site is reliable and strong.
Whether you are running a blog, an online store or a portfolio site, this method is simple and useful. Now let’s move on to how to set it up.
1. Opening External Links in a New Tab Using the Block Editor
WordPress’s block editor, also known as Gutenberg, makes this task very easy. This method is best for those links that you add separately. Here is a step by step guide on how to do it:
Add a link block or click on it
Select the text where you want to add the link. Then click on the Insert Link button in the toolbar above the editor.
Add URL
Type or paste the link of any external website in the box that opens.

Turn on the New Tab option
When you have added the link, click on the gear icon on the side. There will be an option of Open in New Tab, turn it on.

Save the changes
When you have done everything right, click on the Update or Publish button and save the changes.
2. Opening External Links in a New Tab Using the Classic Editor
If you use Classic Editor then there is no need to worry. Easy steps are given below:
First select the text where you want to put the external link

Then click on the chain-like icon in the upper toolbar
Now paste the address of the link in the box that appears. Below it there will be an option which says open link in a new tab, tick it
When everything is done, save the post or page. The job is done
This method is simple and easy for those people who are used to the old design of WordPress
3. Opening External Links in a New Tab Using HTML Code
If you need more control or want a different way, HTML code can help you.
The first step is to switch to HTML view in the editor. If you are using the Classic Editor, click on the Text tab. And if you are using Gutenberg, choose the Code Editor option.
Then use anchor tags. It is important to set the target blank to open the external link in a new tab. Like
a href equals https colon slash slash example dot com target equals blank Visit Example slash a
When you enter the code, save the changes or preview it so that everything is working fine
This method is best for those people who are at a little advanced level and like to work directly in HTML
4. Opening Navigational Menu Links in a New Tab
Do you want the external links in your menu to open in a new tab?
Then follow these steps:
- First go to Appearance in the WordPress dashboard and then click on Menus
- Now either add a new custom link or click on the arrow of an old menu item
- Screen Options will be written at the top of the page, click on it and check that the Link Target option is on
- Now an option will appear below every menu link in which it will be written Open link in a new tab. Tick the box for the link you want
- Then click on the Save Menu button so that your changes are applied
This method is important when you want to open an external website from the menu of your site and go to that new tab
5. Automatically Opening All External Links in New Tab Using a Plugin
If you find it difficult to set the settings manually again and again, a plugin like “External Links” can make your work easier.
Let’s see how to use the plugin:
First of all go to the WordPress dashboard.
Then click on Plugins, choose Add New, and search for External Links. When you find it, install it and activate it.
Now go to Settings and click on External Links.
From there, change the settings of the plugin so that all external links automatically open in a new tab.
If you want, you can customize more options like adding icons or link tracking
When all settings are done, save the changes.
This plugin is best for those websites where there are too many external links
6. Automatically Opening All External Links in a New Tab Using Code
If you don’t want to use a plugin and want a lighter way, then this can be done using a little custom code.
See here how to do it:
First of all go to the WordPress dashboard. Then go to Appearance and open the Theme Editor. There find the functions dot php file.
Now add the below code to that file.
function open_external_links_in_new_tab($content){
return preg_replace('/<a (.*?)href="http/', '<a $1target="_blank" href="http', $content);
}
add_filter('the_content', 'open_external_links_in_new_tab');
Now save the file. After that open your site and check whether everything is working correctly or not
If you add the code yourself then you get more control and your site also runs fast
Keep Visitors Engaged Without Losing Them
By now you have learned many easy ways to make external links of your WordPress site open in a new tab or window. Whether you are using Block Editor, Classic Editor, HTML, plugin or custom code. you can now easily use these methods to improve your website.
If you want more tips to make your WordPress site even better, do join our weekly newsletter or contact us for expert help. We are here to make your WordPress usage easy and smooth.