Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
30 Million+
Websites using our plugins
20+
Years of WordPress experience
3000+
WordPress tutorials
by experts

How to Add Nofollow Links in WordPress (Simple Guide for Beginners)

At WPBeginner, one of the most common SEO questions we get from beginners is how to add a nofollow link in WordPress, and whether getting it wrong can hurt their website.

It can’t, as long as you know the few places where it actually matters.

In this article, we’ll show you how to easily add nofollow links in WordPress. We’ll also discuss when to add a nofollow link without affecting your site’s SEO health.

How and when to add nofollow links in WordPress

Here’s a quick overview of what we will cover in this article.

Simply click on these quick links to jump straight to different sections:

A nofollow link is a link with the attribute rel="nofollow" added to it. This tells search engines not to pass any ranking authority from your page to the page you are linking to.

Links are an important search engine ranking signal. When you link to another website, search engines normally pass a small portion of your site’s authority (often called ‘link juice’ or ‘ranking power’) to it, which can help that page rank higher. A nofollow link stops that authority from flowing.

Google’s treatment of nofollow has changed over time:

  • In September 2019, Google introduced two new link attributes, rel="sponsored" and rel="ugc", and announced it would start treating nofollow as a ‘hint’ for ranking rather than a strict rule.
  • On March 1, 2020, this became official for crawling and indexing too. Google may now still crawl a nofollowed link to discover new pages, but it won’t pass ranking authority through it.

Some people believe that making all of your external links nofollow will help your own WordPress website rank higher.

In our experience, that isn’t true, and it can actually cost you. Used correctly, nofollow is about controlling which links you vouch for, not blocking them all.

How to Add Nofollow Links in the WordPress Block Editor (Default Method)

You can add a nofollow link right inside the WordPress block editor, with no plugin and no code. This is the easiest method for most people, and it works in any post or page.

First, create or edit a post or page. Type your anchor text, select it, click the link icon, and enter your URL. Then click the ‘Advanced’ section inside the link box to expand it.

How to add a nofollow link in WordPress

Check the ‘Mark as nofollow’ box (and ‘Open in a new tab’ if you want). Then press the arrow button or hit ‘Enter’ to apply it.

WordPress now adds the rel="nofollow" attribute to your link for you.

How to Check if a Link Is Nofollow

Every nofollow link contains the rel="nofollow" HTML attribute.

Here is what one looks like in code:

<a href="https://google.com" rel="nofollow">Google</a>

To check any link on a live page, hover over it, right-click, and select ‘Inspect’ in your browser.

View nofollow attribute using inspect tool

Your browser window will split into two parts. In the Inspect panel, you can see the link’s HTML source code, including whether the nofollow attribute is there.

You can also use the free All in One SEO Analyzer by AIOSEO Chrome extension. It highlights nofollow links on any page so you can spot them at a glance.

Highlight nofollow links by using AIOSEO&apos;s browser extension

As a general SEO best practice, you should add nofollow to external links that you don’t fully trust or endorse.

It is perfectly fine, and even recommended, to link to authority sites like Wikipedia or major news outlets without nofollow, because linking to credible sources adds trust to your own content.

Here is a quick reference for which attribute to use for each type of link:

Type of linkWhat to use
Editorial link to a source you trust (e.g. Wikipedia, a news site)Leave it followed (no rel needed)
Affiliate link or paid/sponsored linkrel="sponsored" (or rel="nofollow sponsored")
Link inside a user commentrel="ugc" (WordPress adds this automatically)
Link to a site you don’t trust or can’t vouch forrel="nofollow"
Internal link to your own pagesLeave it followed (never nofollow internal links)

The table covers the rule of thumb. In practice, the case we get asked about most is affiliate and sponsored links.

Many bloggers make money online through affiliate links, which earn a commission when someone buys through them.

For affiliate or paid links, the most precise choice is rel="sponsored" (you can also combine them as rel="nofollow sponsored").

However, WordPress does not have an option to add the sponsored attribute.

To add the sponsored attribute, you have two easy options.

  • Use an affiliate links manager plugin like Pretty Links, which lets you add sponsored and nofollow attributes to your affiliate links.
  • However, if you don’t add affiliate links that often, then many popular WordPress plugins like All in One SEO (shown below) or Yoast SEO also let you easily add the sponsored attribute to your links.

How to Add Nofollow and Sponsored Links With An SEO Plugin

WordPress handles a plain nofollow link well, but it can’t add the sponsored or ugc attributes, and it has no field for a link title.

This is where All in One SEO (AIOSEO) comes in. This plugin adds one-click toggles for nofollow, sponsored, and UGC right in the link box, so it’s a simple way to mark affiliate links correctly. You can use the free or premium version.

First, install and activate the All in One SEO Premium or the AIOSEO free plugin.

Next, create or edit a post or page, add your anchor text, select it, and click the link icon.

This opens the link box with several options you can toggle on or off. We recommend turning on both ‘Open in a new tab’ and ‘Add “nofollow” to link’.

AIOSEO adding a nofollow sponsored link

AIOSEO also adds toggles for sponsored and ugc in this same box, plus a field to add a title attribute to your link.

The title attribute shows a small tooltip when someone hovers over the link, which is good for accessibility and clarity.

Once done, click the arrow button or press ‘Enter’. This adds the nofollow link to your content.

How to Add Nofollow Links in WordPress Menus

You can also add a nofollow attribute to links in your navigation menus without a plugin. The option is just a little hidden, so we’ll show you where to find it.

Method 1: Modern Block Themes (Appearance » Editor)

If you use a modern WordPress theme, your menus live in the Site Editor instead. Go to Appearance » Editor and click the template that contains your navigation menu.

After that, click [+] to add a new link. In the right sidebar, you will see Block settings for that individual link.

Adding nofollow link in WordPress navigation menu

Type nofollow into the ‘Rel Attribute’ field, then click the ‘Save’ button at the top of the screen. WordPress will add the nofollow attribute to that menu link.

Method 2: Classic Themes (Appearance » Menus)

First, go to the Appearance » Menus page in your WordPress admin.

Choose the menu you want to edit and click the ‘Select’ button to open it.

Select menu in classic theme

Next, click the ‘Custom Links’ tab, add your link text and external URL.

Then, click the ‘Add to Menu’ button.

Add menu item

The link now appears in the Menu Structure column. Before you can add a nofollow attribute, you need to turn on a hidden setting.

Click the ‘Screen Options’ button in the top-right corner of the page.

Adding link relationship checkbox to menus

Check the ‘Link Relationship (XFN)’ and ‘Link Target’ options.

Now scroll down and click the downward arrow on your new menu item to expand it.

Adding nofollow to a navigation menu item in classic theme

Type nofollow into the ‘Link Relationship (XFN)’ box. You can also check the ‘Open link in a new tab’ option if you want.

Don’t forget to click the ‘Save Menu’ button.

How to Automatically Make All External Links Nofollow

Important: We don’t recommend automatically nofollowing every external link. It’s a blunt approach that stops you from passing authority to credible sites, which is actually a positive SEO signal.

Manually controlling your links is almost always better. But if you understand the trade-off and still want to do it, here are two ways.

Method 1: Using the WP External Links Plugin

The easiest option is the WP External Links plugin, which adds the nofollow attribute to external links in your posts, pages, menus, and sidebar. That makes it the right choice if you have external links in site-wide areas like your sidebar or footer, which the manual and code methods above don’t reach.

First, install and activate the plugin. For help, see our guide on how to install a WordPress plugin.

Upon activation, go to the new WP External Links page in your WordPress dashboard.

Adding nofollow to all external links

Change the ‘Set follow or nofollow’ dropdown to ‘nofollow’.

Above it, you can also set external links to open in a new tab using the ‘Open external links’ dropdown.

Adding nofollow to all external links

Click the ‘Save Changes’ button. The plugin will now turn all external links on your site into nofollow links.

Method 2: Using a Code Snippet With WPCode

If you prefer a lightweight, code-based option, you can use a free snippet plugin like WPCode. It lets you safely add custom code to your site without editing theme files.

After installing and activating WPCode, go to Code Snippets » + Add Snippet, choose ‘Add Your Custom Code (New Snippet)’, and give it a title like “Nofollow All External Links”.

Adding a Custom Snippet in WPCode

Set the Code Type to ‘PHP Snippet’ and paste in the following code:

add_filter( 'the_content', 'wpb_nofollow_external_links' );

function wpb_nofollow_external_links( $content ) {
    // Extract just the host domain (e.g., 'www.wpbeginner.com') without the protocol
    $host = preg_quote( wp_parse_url( home_url(), PHP_URL_HOST ), '/' );

    return preg_replace_callback(
        '/<as[^>]*href="https?://(?!' . $host . ')[^"]+"[^>]*>/i',
        function ( $matches ) {
            $link = $matches[0];

            if ( stripos( $link, 'rel=' ) === false ) {
                return preg_replace( '/<as/i', '<a rel="nofollow" ', $link, 1 );
            }

            if ( ! preg_match( '/rel="[^"]*nofollow[^"]*"/i', $link ) ) {
                return preg_replace( '/rel="([^"]*)"/i', 'rel="$1 nofollow"', $link, 1 );
            }

            return $link;
        },
        $content
    );
}

Set the insertion method to ‘Auto Insert’ with the location ‘Run Everywhere’, then toggle the snippet to ‘Active’ and click ‘Save Snippet’.

For more details, see our guide on how to add custom code in WordPress.

One important limit: this snippet only adds nofollow to external links inside your post and page content. It will not touch links in your navigation menus, sidebar, footer, or other widget areas. If you need those covered too, the WP External Links plugin above is the better choice.

Frequently Asked Questions About Nofollow Links

We’ve helped thousands of users with their WordPress sites, and these are the questions about nofollow links that come up most often.

How do I make a nofollow link in WordPress?

In the block editor, add your link, expand the ‘Advanced’ section in the link box, and check ‘Mark as nofollow’ (built into WordPress since version 6.4). WordPress can’t add the sponsored attribute, so for affiliate links, use a plugin like AIOSEO or Pretty Links.

What is the difference between nofollow, sponsored, and UGC?

Use rel="nofollow" for sites you don’t endorse, rel="sponsored" for paid or affiliate links, and rel="ugc" for user-generated content like comments. WordPress adds ugc to comment links automatically.

Should I add nofollow to internal links?

No. Never nofollow your internal links. Internal links help search engines crawl your site and pass authority between your own pages, which is good for SEO. If you want to keep one of your own pages out of search results, use a noindex tag or a robots.txt rule instead, not nofollow.

What is the difference between nofollow and noindex?

They do different jobs. nofollow is a link attribute that controls whether you pass authority through a single link. noindex is a page-level instruction that tells search engines not to include that page in search results at all.

What is the difference between nofollow, noopener, and noreferrer?

noopener and noreferrer are security and privacy attributes WordPress adds automatically for links that open in a new tab, and they have no effect on SEO. Only nofollow affects link authority. You can safely combine all three: rel="nofollow noopener noreferrer".

Additional Resources for Using Links in WordPress

We hope this guide helped you learn how to add nofollow links in WordPress.

You may also want to see these related tutorials:

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

48 CommentsLeave a Reply

  1. This information is very useful for me. Since I also want to work with sponsored links, the knowledge I read in this article is essential.

  2. Great article about using the “nofollow” attribute! This helps to ensure that link juice isn’t passed on to external sites you don’t necessarily endorse. And I think that adding nofollow links to sponsored content or affiliate links, it’s good practice to also disclose that relationship with the linked site to your readers. This builds trust and transparency with your audience.

  3. it’s awesome that the new WP version (6.5) now includes the option to add no-follow atrribute natively. I’ve been waiting for an easy way to add the nofollow links in images

    • It is a good idea to use the no follow link from the default editor.
      But assuming the importance of seo, almost everyone used AIOSEO or some other seo plugins. We can always use this to make the link as no follow link.

  4. Why would you not just put a global nofollow in robots.txt and then individually allow certain links to be “follow” post by post?

    • Your robots.txt would normally be best used for only your site’s links which is why we don’t recommend that method.

      Admin

  5. Adding a nofollow link to the external links seems promising for seo and rankings.
    It is best to argue that we should not use nofollow to credible websites but only to less credible websites.
    I have doubt here regarding less credible sites.
    Why would anyone use external links as a reference for less credible or no credible sites?

    • It would depend on the content being covered by the site for what external links would make sense.

      Admin

  6. I have previously read that the ratio of follow and nofollow links should be considered and logical. Well, according to human logic, the number of nofollow links should naturally be higher. However, utilizing follow links from valuable websites can also be effective in the growth of the site. What factors should we consider when deciding whether to consider a link as follow or nofollow?

    • The main thing to keep in mind is to a high value or authority site and that would normally be when you would not need to use nofollow.

      Admin

  7. I’ve read that from an SEO standpoint, it’s better to have external links as nofollow. This way, the search engine robot focuses more on internal links on the website. Therefore, I’ve set all external links as nofollow via a plugin. Is this a good technique, or is it better to make exceptions for high-quality links from domains with high domain authority?

  8. Sure! Making external links is a great way to give your juicy backlinks breathing space and a chance to rank higher on search engine results pages for the likes of Google, Bing, Yandex, Yahoo, DuckDuckGo, etc. Remember, too many links on one page/blog may feel like spam in the eyes of the search engine crawling bots. So, to offset the workload, a dofollow link function helps minimize the chances of overusing links on any given piece. This article has helped us (webmasters) with more ways to address the same adequately. We hope to see more resources from you soon.

    Kudos for the excellent job well done!

    • Thank you for sharing this feedback and yes too many links can look spammy to search engines.

      Admin

    • It would depend on on your niche, normally it would be a site you trust that you would confidently send your users to visit.

      Admin

  9. “Some WordPress users want to automatically add the nofollow attribute to all external links on their site. Most solutions that offer this are done with the help of JavaScript. This is not helpful for Google or for your site’s SEO.”

    I kinda understand why it’s not helpful for Google as it looks at dofollow links as a ranking factor. But why would having all external links as nofollw be bad for your site’s SEO?

    • Linking to credible sites can be helpful to show you know which site is trustworthy sources for your users which can help your ranking.

      Admin

  10. Thanks for sharing all the option possible to render nofollow external links.

    But don’t you think noreferer noopener means nofollow as well, too.

  11. I have been told that my Privacy Policy page should be no follow. How do i do that for a page?

    • If you have an SEO plugin, there is normally an option added in the page’s settings to nofollow a page.

      Admin

  12. How do I add a no follow to links in the photo caption? Image credits contain links to the photographer and the site I downloaded it from.

    • For the simplest method, you could use the external links plugin from this article.

      Admin

  13. Nice Post,

    May I Know that rel=”nofollow noreferrer opener” and rel=”noreferrer opener nofollow ” both are same? I don’t know exactly where I need to insert “nofollow” when it comes to “noreferrer opener”.

  14. I activated the External Links plugin and saved the changes, but when I check the HTML code in the post, I don’t see “no follow” anywhere in the code. Is it supposed to show up there?

  15. Hi there,

    Can you perhaps suggest another plugin to use with the Classic Editor?

    It seems ‘Title & No Follow for links’ is outdated . Im getting this msg:

    “This plugin hasn’t been tested with the latest 3 major releases of WordPress. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.”

    TIA

  16. Every time i try to achieve this i break my post and get an error message ,but i suspect the message is caused by myself not entering the code correctly (i have no coding experience) my little portion of code looks different to your example.for individual links

    Solution i entered the code manually using the code editor as described in your tutorial and that seemed to work this method was much easier for me.

  17. This tutorial is incorrect I keep getting error messages that has ruined my post and I cannot recover them.This Block Has Encountered An error and Cannot Be Previewed

  18. Hi, is there a way to add a no-follow to a WooCommerce product affiliate link (without a plugin).
    Ex. I can add a product in WooCommerce and change from a “Simple product” to a “Extern/Affiliate product”. I can insert the link, but not edit any html or option to set to no follow.
    Thanks.

    • You would want to reach out to WooCommerce’s support for how to customize the external link to be nofollow when there is not a default option to.

      Admin

  19. Thanks for sharing all the possible option to make external links nofollow.

    But don’t you think that noreferer noopener also means nofollow.

    • While they look similar, those are used for slightly different reasons than nofollow. Nofollow is more for crawlers such as Google to not follow that link in terms of SEO while noreferrer and noopener limits how much the site you link to knows about your link to the site.

      Admin

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.