How to Add rel=”sponsored” to Affiliate Links in WordPress

Google has issued new recommendations that affiliate links be identified with a “sponsored” attribute. Here’s how to add that in WordPress.

Google Guidance on Using REL Sponsored in Affiliate Links
Google Guidance on Using REL Sponsored in Affiliate Links
Last Updated:
Topics: SEO

This post may include affiliate links. Read more.

Back in early-2020, Google updated their guidelines for using rel=”nofollow” on links, added some new link attributes, and changed the way that they used them for determining SEO ranking.

They now treat these as “hints” rather than instructions, and they added new attributes “ugc” and “sponsored“.1 These changes were implemented as part of a link spam update, one of the many tweaks Google is constantly making to their ranking algorithm.2

Initially, it appeared that adding “sponsored” to affiliate links was optional, and that so long as you have “nofollow” on them, that was enough.3 While that might still be true–that it’s more of a preference than a requirement–Google has recently suggested that they’re leaning more toward requirement.

This is what they’ve said more recently:

Affiliate links on pages such as product reviews or shopping guides are a common way for blogs and publishers to monetize their traffic. In general, using affiliate links to monetize a website is fine. We ask sites participating in affiliate programs to qualify these links with rel=”sponsored”, regardless of whether these links were created manually or dynamically.

As a part of our ongoing effort to improve ranking for product-related searches and better reward high-quality content, when we find sites failing to qualify affiliate links appropriately, we may issue manual actions to prevent these links from affecting Search, and our systems might also take algorithmic actions. Both manual and algorithmic actions may affect how we see a site in Search, so it’s good to avoid things that may cause actions, where possible.

While it was couched as a “reminder,” and in other places they’ve said that nothing’s changed in the guidelines, it certainly reads as an implicit threat of negative effects on a site’s ranking. There’s more than a whiff of “or else” hanging over it.

NoFollow vs Sponsored / NoFollow + Sponsored

Google’s recommendation for a long time is that external affiliate links–or any other kind of paid links–should have a “nofollow” attribute. I’m not sure off-hand whether they’ve explicitly said at some point that it’s a requirement, but there has certainly been the strong implication and presumption that it matters in terms of ranking your pages. And it’s something that I’ve been doing for years.

Google’s announcement of the new attributes was less than perfectly clear, and it sparked quite a bit of confusion. Not just about whether to implement it, but how to implement it. And there’s one specific aspect I want to mention here.

That is whether to add sponsored or replace nofollow with sponsored. Google has explicitly said that the new attributes can be used in combination. So rel="nofollow ugc sponsored" is perfectly valid.

In my reading of the new guidelines, it’s not clear whether “sponsored” renders the “nofollow” redundant or not. They don’t have precisely the same meaning, but what’s not clear is whether having “sponsored” also implies “nofollow.” It’s possible that it does, but it’s so easy to keep both attributes that the way I’ve chosen to implement is with both (i.e., rel="nofollow sponsored"). It seems the safe option, even if it might not be strictly necessary, and there really doesn’t appear to be any downside.

So that’s why I’m referring to “adding” the attribute here. The way I’ve chosen to implement it on my sites is to include both (eg. rel="nofollow sponsored"), because both attributes are independently accurate for what I want to indicate. But the same methods below, with minor tweaks, apply if you decide to omit or replace an existing “nofollow” value.

Manually Add rel=sponsored to Links

The most bare-bones method to adding the sponsored link attribute is to manually add the HTML to the HTML link. This is simple and reliable, but it’s really only practical if you’re working with a relatively small number of links.

WordPress does not currently have sponsored as an option in the Gutenberg Block Editor or the Classic Editor in the way that you can set the link target to a new tab. But you can easily add the code to the HTML link in the plain text or HTML editor by inserting “sponsored.”

I’m going to assume that you already have your affiliate links tagged with nofollow. And if you’ve saved the post in WordPress, you likely also have noopener, which WordPress now applies automatically by default. In that case, it’s simply a matter of adding “sponsored”. The result would be something like this:

rel="nofollow sponsored noopener"

Or, for a full link, it might read something like:

<a href="https://gizmo.com/whizzbang" rel="nofollow sponsored noopener">Whizz Bang Gizmo</a>

You might also have a title attribute and/or a target attribute. Those are separate and can stay.

Using a Plugin

Some link management plugins have started including the option to add the sponsored attribute. One of the best ones I’ve come across is WP External Links by WebFactory Ltd. It’s free. It also has a number of other useful features, such as being able to open external links in new tabs, adding nofollow attributes, and so on.

The advantage of this method is that, at least by default, it applies across the whole site. And the attribute is added on the fly as the page is rendered, so it doesn’t hard-code the attribute into the original post. But if you don’t want it to apply to every external link, it is possible to sculpt the output with exclusions and exceptions, but that can get a little messy and will vary by the specifics of the links on your site.

WP External Links Plugin for Adding Sponsored REL Attribute

Search & Replace

A more global solution that you can use for any number of links is to hard-code the sponsored attribute into the links using a global search and replace tool across the site.

How easy this is on your site depends largely on how disciplined you’ve been with your links. That affects how effective one or two search terms can be in finding all instances of a link. If all your affiliate links are already in HTML format (rather than Markdown) and already include “nofollow”, it’s a pretty straightforward procedure. In that case, something as simple as this might work:

search: rel="nofollow
replace: rel="nofollow sponsored

But you might have to do it in several steps (or use regex) if your affiliate links aren’t consistent across the board.

WordPress Search & Replace Tools

There are various methods to doing this. Some involve tools with graphical user interfaces; some are performed directly on the database. Something they all share in common is that they can royally screw up a site with even a small syntax error. So it’s very strongly recommended that you create a full site backup before starting (or, better yet, work on a staging site).

One of the search/replace tools I prefer is a plugin called Better Search Replace. And a reason I prefer it is precisely because it’s not as powerful as some of the other options. By default, it runs a dummy run without actually changing anything. That’s useful for confirming that you’re not getting some unintended consequences. And you can specify on a very granular level which database tables to apply it to (you probably want it on the _posts table). It also happens to be multisite-friendly, which is important in my setup.

If you’re comfortable using regex, I’ve found Search Regex to be very good.

And for a very powerful option, Search Replace DB is great (but can lead to a mess if you’re not careful).

Some site hosts also offer dashboard tools for search and replace.

Kinsta (who happens to host my sites) has a very good guide to WordPress search and replace here.

Things Worth Knowing

There has been some confusion in the affiliate community about whether identifying links as “sponsored” will run afoul of Amazon’s prohibition on characterizing an affiliate’s relationship with Amazon as sponsored.4 The folks at Geniuslink have taken a deep dive on this to try to clear it up. Their conclusion is: “using “rel=sponsored” with Amazon affiliates links is indeed allowed, and does not pose a compliance risk to your Amazon Associates account.”


  1. The “ugc” attribute is for user-generated links, such as those in a comments section or on a forum discussion site. 
  2. The Link Spam Update coincides in timing with the rollout of the Core Web Vitals update, but this isn’t directly part of Core Web Vitals. 
  3. Affiliate links are broadly considered to be “paid or sponsored” links in this discussion. 
  4. The Amazon affiliate Operating Agreement includes this language: “You will not misrepresent or embellish our relationship with you (including by expressing or implying that we support, sponsor, or endorse you), or express or imply any affiliation between us and you or any other person or entity except as expressly permitted by this Agreement.” 

Leave a Comment