I recently added a link in my primary nav menu to a commercial product and wanted to make sure it was no follow which is why i’m writing this post.
I knew i could use the menu item settings but also wanted to work out another solution which no follows all menu item links.
Here’s both solutions you can choose from to no follow one or more nav menu links in WordPress:
1. No Follow Using Link Relationship (XFN)
- Firstly, make sure this setting is enabled in your screen options.
- Then you can simply add nofollow to the Link Relationship (XFN) field for each menu item you want to no follow.
2. No Follow All Nav Menu Links Using Filter
You can use this custom function with filter in your child themes functions file to no follow all nav menu links:
You could also use a custom walker function to built no follow into all nav menu items which you would only use if you’re using the function for something else as well.