Exercise: Making menu links open in a new tab

Hire a WordPress Expert on Codeable
Updated On: January 14th, 2025 0 Comments

In a previous lesson, I created a menu link called “Me Elsewhere” for my header menu and linked it to my other website.

So, when users click on it from the header menu, they will be taken to my portfolio website.

0:00

/

This is nice.

But the problem here is when the user clicks on the link, the browser closes the current website (criyasoft.com) and opens up a different website (naresh.dev) in the same tab.

This is making me lose the user.

The user might never come back to my current website because a closed website is a forgotten website.

Remember, my current website has its own goals in terms of sales, ad income, service requests, etc.

So, the goal here is if the links on my website are taking the user to an external website, I need to make sure that my current website is still open.

How do we achieve that?

Simple.

We should force the user to open the external link in a new browser tab.

For example, in my case, when the user clicks on the “Me Elsewhere” link, it should open up my other website in a new tab:

0:00

/

Did you see that?

It helps visitors come back to our website easily by switching the browser tabs.

0:00

/

This is very easy.

First, make sure you’re inside the “Menus” screen.

Next, open the settings of the menu item that you want to open in a new tab.

You can do this by clicking on the arrow icon of the menu item:

But if you notice, there is no option to open this menu item in a new tab.

This is because the “Link Target” option for individual menu items must be enabled first.

To enable this option, click the “Screen Options” button in the top-right-hand corner.

This will bring up the “Screen Options” interface.

Next, from these options, enable the “Link Target” option.

If you now go ahead and open up the menu item’s settings again, this time you will find a new option called “Open link in a new tab”:

Enable it by clicking on it.

Finally, save the changes by clicking the “Save Menu” button.

If we now click on the menu link, it opens in a new tab.

0:00

/

That’s all.

In the next lesson, we will learn how to rename a menu link.

Leave a Reply

Your email address will not be published. Required fields are marked *