I’ve been getting this question a LOT recently, and other similar ones as well, all related to the WP navigation menu. So in this quick post I’ll cover the 3 most common issues.
- How to add a simple custom link.
- How to add rel=”nofollow” to a menu item, so Google doesn’t follow the link to the target url.
- How to get a menu item to open in a new tab/window.
The main reason people want to add no follow link to their menu is usually SEO related. They don’t want any link-juice/authority to bleed through to the target url, definitely if it’s going off-site.
Ok, let’s get started.
How to add rel=”nofollow” to WordPress menu items
1. Add your menu item to a menu
Pretty straightforward, choose a page, hit add. Or if you want to add a custom link, expand the custom links section, input the target url, the link text, and hit “Add to Menu”
Next, expand the menu item itself, and you’ll, of course, notice the absence of any options related to opening the link a new tab/window or adding nofollow.
2. Enabling the nofollow and link target options
To add these options, check top right of the WP admin area for the screen options toggle, hit the triangle to show the options, and tick the checkboxes “Link Target” & “Link Relationship (XFN)”.
While “Link Target” is pretty self-explanatory, “Link Relationship (XFN)” is a bit more complex. The main purpose of this option is to define/represent human relationships you have with the target site, you can find a more detailed explanation here. But for our purposes, all you need to know is that it adds rel=”” to our links.
If you go back to your menu item now, you’ll see the extra options enabled, go ahead and tick the “Open link in a new tab” option if you want your link to open in a new window/tab, and then type “nofollow” in the “Link Relationship” field to make the link nofollow.
3. Check the link
Then don’t forget to save the menu! You can double check if it worked by checking your site, right-clicking the menu item and choose Inspect to bring up the dev window.
Then search for your link and check if re=”nofollow” has been added.
And that’s it, super easy 🙂