Have you ever wondered, or did you need open external links in a new window or tab with wordpress?
Many times when we are writing a new post, we want to add external links that go to other websites, in this case we want the link to open on a new page or tab, since we are going to leave our website, but we want it to remain open.
External links are beneficial for our SEO, Yoast SEO always recommends adding an external link.
if you create a link to another website, the owner may return the favor in the future. This helps websites share visitors with each other. While you may think this will hurt your website, reaching new visitors far outweighs the risks.
Gutenberg is now the default WordPress editor, and we will see how easy it is to add a link and open it in a new tab.
The first thing we are going to do is click on the “link” icon to be able to select the text that we want to convert into a hyperlink.
Now we write the URL and click on “link settings“.
Once we have opened the settings, we select the option “Open In New Tab“.
In this easy way we can create a link that opens in a new tab.
Using Classic Editor
For a few versions of WordPress, by default the Gutenberg block editor is used, to return to the classic editor we have to download a plugin, the classic editor plugin.
Now that we have the classic version of the editor, we will do something similar to the Gutenberg editor. First of all we are going to select the text that we want to convert into hyperlink and click on the “insert/edit link” icon.
Enter the URL we want to access and click on the “link options” icon.
A new window will be opened where we can edit or insert a link, we simply have to enter a URL, the link text, and we will check in “Open link in a new tab“.
We may ever be presented with the option of being able to enter some HTML code, well, if we want our link to open in a new window we will only have to add the following code to our “a” tag target=”_blank”.
<a href="Your URL Here" target="_blank" rel="noopener">External Link</a>
As we have seen, it is very easy to add a hyperlink that opens in a new window or a new tab.