This WordPress Code May Get Your Affiliate Account Shut Down. Here’s How to Fix It

One of our students had his Amazon Associates account closed recently.

I helped him get it back, and based on what happened I have reason to believe that almost everyone using WordPress is at risk of having their account shut down for non-compliance with Amazon’s Terms and Conditions.

Here’s the scoop:

When WordPress released its 5.0 version, the WP team gave us more than the revolutionary Gutenberg block editor. WP also made some changes that affect how your links look and, more importantly, how they function.

Specifically, WP started automatically adding  two tags —  ‘noopener’ and ‘noreferrer’ — to links that open up in a new window. WP added these tags as a security measure to protect visitors from malicious websites.

The goal was to decrease the security risk of your visitors by preventing a transfer of information.

But a side effect has been account closures by Amazon.

OOPS

Amazon doesn’t say this explicitly, and we haven’t been able to get confirmation from them on this, but based on our students’ story below, there is a chance that you might unwittingly be violating Amazon’s policies.

Here’s everything you need to know about this issue and how to fix it on your site:

What Your Affiliate Link Code Looks like

Let’s go behind the scenes for a moment.

When you work in WordPress and want to add a link that opens in a new window, the link code will look something like this:

<a href="https://domain.com" target='_blank'>Link text</a>

This code makes the words ‘link text‘ clickable. When someone clicks on the clickable text, they’ll be sent to the target site, domain.com. Because of the words target=’_blank‘, the link will open in a new window.

Incidentally, as an affiliate, you should be manually adding a ‘nofollow’ tag to your links to satisfy Google’s requirement to do so. When you add a ‘nofollow’ tag, your link code will look like this:

<a href="https://domain.com" rel="nofollow" target='_blank'>Link text</a>

The nofollow tag instructs search engines not to pass link juice to Amazon. Amazon doesn’t have a problem with ‘nofollow’ tags, and they aren’t really relevant to this discussion, but I’m reminding you that you should be adding them to your code.

What WordPress is Now Adding Automatically to Your Links

When you create a link that opens in a new window, WordPress now automatically adds ‘noopener’ and ‘noreferrer’ tags to the link code.

Link code with the ‘noopener’ and ‘noreferrer’ tags looks something like this:

<a href="https://domain.com" rel="nofollow noopener noreferrer" target='_blank'>Link text</a>

Noopener instructs the browser not to pass on information from the original tab to the newly opened tab. As I mentioned, WP adds ‘noopener’ to increase the safety of site visitors. Amazon doesn’t seem to have a problem with ‘noopener’ tags, and because they can potentially protect our site visitors, we’re also OK with them.

The ‘noreferrer’ tag is different.

What is the Noreferrer Tag? What Does It Do?

Noreferrer instructs the browser to essentially hide identifying information about the referring site. If you use ‘noreferrer’ on a link to an external site (Amazon for example), the owner of that other site can’t tell that your site referred the visitor.

Like ‘noopener’, ‘noreferrer’ is added by WP for security purposes. It works by preventing hackers from taking over a newly opened tab and possibly accessing your visitor’s private information.

Simply put, WP added the ‘noreferrer’ tag to protect your site visitors by preventing a transfer of referrer information to the target site.

So, the ‘noreferrer’ tag also protects users from the nasty intentions of malicious hackers. Sounds good, right?

Why the Noreferrer Tag May Get Your Account Shut Down

As I explained, if you send a customer to Amazon via one of your affiliate links, the ‘noreferrer’ tag will hide information about where the customer came from. Amazon will recognize that you sent this customer (your affiliate ID will tell Amazon that) but will be unable to determine from which website or page.

The problem is, Amazon doesn’t like the fact that referrer information is masked. Amazon wants to maintain tight control over the affiliate process, and that involves checking referrer sites periodically to verify compliance. Without specific identifying information about referrer sites, Amazon can’t check for compliance.

Amazon Compliance
Is this what the desk of an Amazon compliance reviewer looks like?

I haven’t gotten any explicit information from any of the Amazon reps I’ve spoken to about this, but I have reason to believe that Amazon has actually closed affiliate accounts because they’ve been denied access to referrer information.

What makes me say this? Read on.

How Our Student Lost His Account And Then Got It Back

About 3 weeks ago, a student of ours named Lucas had received a pretty ominous email from Amazon telling him his Amazon affiliate account had been closed. The email explained that “Amazon couldn’t see” his link tags. To the best of his knowledge, Lucas was in compliance with Amazon’s Terms and Conditions. Obviously, he wanted to have his account reinstated but was unsure how to proceed.

Lucas is a member of Digital Worth Academy, so he reached out for help in our community. And of course, I was happy to help him out.

When I checked his site, I spotted the ‘noreferrer’ tag in his affiliate links. I suspected this might be a problem since it’s the only thing I could think of that would cause Amazon to “not see” his links.

I immediately contacted Amazon to ask if the ‘noreferrer’ tag might have led to the closure of Lucas’s account. The Amazon Associates rep responded that, yes, the additional code “could be masking your tags.” This, in turn, “could cause our review team to reject/close your application.”

Although the rep was unwilling or unable to confirm that the ‘noreferrer’ tag was the reason for Lucas’s account closure, he indicated that the new code might, in fact, be to blame. The problem, I pointed out to the rep, is that WordPress now automatically adds the ‘noreferrer’ tag to links that open in a new window. When I asked if Amazon offers a fix for this potential issue, the rep said no, Amazon doesn’t have a fix.

Here’s are some screenshots from our conversation:

Hmm. Now, what?

Confused...

Fortunately, I was able to get Lucas back up and running. Although the Amazon rep I spoke to didn’t confirm that the ‘noreferrer’ tag was the reason for the account closure, I assumed the new code is what got him into trouble. With this in mind, I gave him a tweak to remove the ‘noreferrer’ code…

And, lo and behold, his account was reinstated!

Oh Happy Day!

What You Need to Do

Before I tell you what to do, here are a few important points to keep in mind:

1. It is possible the ‘noreferrer’ tag only created a problem for Lucas because his affiliate account was pending approval and was therefore subject to a more rigorous review process. On the other hand, as I was researching the issue, I did encounter at least one story of a long-standing affiliate whose account seems to have been closed as a result of the ‘noreferrer’ tag. As happened with our student, her account was reinstated when she removed the tags.

2. To be clear, Amazon doesn’t state explicitly that an affiliate shouldn’t add ‘noreferrer’ tags to their links. There is no clear statement in the Terms and Conditions that having such code could result in the closing of one’s account. However, in Lucas’s case, and in other cases I’ve read about, removing the code seems to have been enough for Amazon to reopen his account.

3. If you use Amazon, and you open affiliate links in new tabs, I highly recommend you remove the ‘noreferrer’ code from your links in order to prevent an account closure. Until Amazon and WordPress work this out, or until Amazon tells us explicitly that ‘noreferrer’ tags won’t get you into trouble, I strongly suggest removing the tags.

How to Check For ‘Noreferrer’ Code in Your Links

Your first step should be to check whether your affiliate links do, in fact, contain the ‘noreferrer’ tag. Some WordPress themes (Thrive, for example) will not add these tags for you, and it’s possible you are using such a theme and therefore do not have to worry about this issue.

To check if your site is at risk:

1. Open a blog post in your browser, and locate an affiliate link that opens in a new tab.

2. Right-click on the link and click on ‘inspect.’

Inspect Element

3. A pane with code will appear on the right with the link code highlighted.

Here is the code section from the image above – enlarged.

Noreferrer code

Look at the link code and check if a ‘noreferrer‘ tag has been added. In the image above you can see that the ‘noreferrer‘ code does indeed appear in this example (pointed to by the red arrow).

If you don’t have the code, then you are ok. If you do see the ‘noreferrer‘ code in your links, then read on to find out what you need to do.

How to Prevent the Addition of ‘noreferrer’ Tags to Future Posts

If WordPress is adding ‘noreferrer’ to your affiliate links, I suggest you do the following to prevent it from adding it to posts you publish or update in the future:

1. Add a new plug-in: go to plugins in your WordPress dashboard and click on ‘add new’.

Add Plugin

2. Search for ‘code snippets’. Locate it, click on ‘Install now’, and click ‘Activate.’

3. Click on ‘Snippets’ in your dashboard. You want to add a new Snippet, so click on ‘Add new’ at the top of the page.

4. Give the snippet a title such as ‘Prevent noreferrer from being added to new or updated posts’. Copy and paste the following code:

//This code prevents noreferrer from being added to new or updated posts
function im_targeted_link_rel($rel_values) {
return 'noopener';
}
add_filter('wp_targeted_link_rel', 'im_targeted_link_rel',999);

Then make sure ‘run snippets everywhere is selected.

Here’s your animated gif:

Code to Prevent Noreferrer

5. Click on ‘Save Changes and Activate’.

6. If you have a caching plugin, clear your cache and you are done (thank you to our reader Cathy for reminding us of this step!).

Note: this will not remove ‘noreferrer’ from existing links. It will, however, prevent WP from adding the ‘noreferrer’ tag to links you create in the future.

How to Remove Existing ‘noreferrer’ Tags

To remove ‘noreferrer’ tags from existing links, do the following:

1. Click on ‘Snippets’ and ‘Add new.’

2. Give the snippet a title such as ‘Remove noreferrer from existing links’. Then copy and paste code the following code which will remove ‘noreferrer’ from existing links:

//remove noreferrer from existing links on the frontend (they may still show in the post editor)
function im_formatter($content) {
$replace = array("noreferrer " => "" ," noreferrer" => "");
$new_content = strtr($content, $replace);
return $new_content;
}
add_filter('the_content', 'im_formatter', 999);

(note: code edited on Aug 2 to cover all linking configurations)

Select ‘run on site frontend’.

Code to Remove Noreferrer

3. Click on ‘Save Changes and Activate’.

4. If you have a caching plugin, clear your cache.

Important: make sure to test your links – both new and existing ones – after making the code changes to confirm that ‘noreferrer’ no longer appears in old or newly created links.

Here is what my link looks like after adding the snippets:

No more Referrer

As you can see, the ‘noreferrer‘ tag no longer shows up in the code. It is gone!

Takeaways

It is unclear why this is only becoming a problem for Amazon affiliates now.

With previous versions of WP that utilized the ‘noreferrer’ tag, Amazon stated that the masking of referrer information wouldn’t affect affiliate accounts. So, it’s possible an Amazon reviewer misunderstood Amazon policy and made a mistake by closing our student’s account. Of course, it’s also possible that Amazon has changed its policy and is no longer OK with ‘noreferrer.’

Even if our student’s account closure was due to a reviewer’s mistaken understanding of Amazon policy, according to my research, our student isn’t the only affiliate who has experienced this.

So, why risk having your own account closed?

Bottom line is, I highly recommend removing ‘noreferrer’ tags from your affiliate links to ensure your account stays up and running. Amazon isn’t saying outright that they’re closing accounts due to ‘noreferrer,’ but anecdotal evidence suggests they are.

I want to save you the pain, hassle, and loss of income associated with such a closure. Leave a comment if you need help dealing with your ‘noreferrer’ tags or if you have any other questions or concerns. And enter your email address in the form below to get our strategy and be notified of other important issues related to affiliate marketing.

Sara Young

I'm a mom of 7 and digital asset builder. 25 years of experience in online marketing and computer programming have given me a unique understanding of how things work online. I share it with you here.

This post has 33 comments

Leave a Comment

33 thoughts on “This WordPress Code May Get Your Affiliate Account Shut Down. Here’s How to Fix It”

  1. Hi Sara,

    This information is so helpful. I have been looking for a way to remove the “noreferrer” tag ever since I started using Gutenberg but couldn’t find a way to do it. So, thanks a lot for the timely tutorial.

    Bianca

    • Thanks for letting us know, Catherine. This kind of feedback helps us know what information people would like to see here.

    • That’s a good question. I actually tested the speed of one of our posts with and without the snippets and did not see a difference.

  2. After I made the changes the noreferrer was still there.
    So I went deleted my cache through my caching plugin which fixed it.

    Just want to let yall know in case anyone else has that issue.

    Thanks so much for this fix!

  3. Thank you, Sara! I really appreciate your clear instructions and screenshots. I checked some of my links, and they did not have noreferrer. I am using a Thrive theme and Thrive Architect. I’ll bookmark this article for future reference, though, just in case.

    • Right. A few people who use Thrive Themes have told me they are not getting ‘noreferrer’ added to their links. So far it’s the only theme I know of that prevents this.

  4. The existing noreferrer code didn’t work for me. Might want to try this one
    //remove noreferrer on the frontend, *will still show up in the editor.*
    function my_formatter($content) {
    $replace = array(” noreferrer” => “” );
    $new_content = strtr($content, $replace);
    return $new_content;
    }
    add_filter(‘the_content’, ‘my_formatter’, 999);

    • I’m glad that worked for you. Thanks for letting us know.

      This still won’t work for all sites, though. I’ve now updated the code in the main article so it does work for everyone.

      Thanks again for your feedback!

  5. Sara, Adding the existing noreferrer code didn’t help. Still showing in old list posts. I have sent a support ticket in – cheers!

  6. Hi Sara,

    Thanks for the information, but somehow the “Removing noreferrer from existing link” code didn’t work for me as well. Any suggestions why this is not working? By the way, I don’t have any caching plugins installed.

    • It turns out there were some site configurations that weren’t covered by my original code. I just updated that code snippet in the article and now it will hopefully work for everyone. Try it and let me know!

  7. Great article! It was brought to my attention in my Facebook group so I knew I had a little work to do. I just need a point of clarification here. I wasn’t sure if it worked for me or not UNTIL I used the right-click and “Inspect” step on one of my posts while in Preview mode…and yep, I got “nofollow noopener” which is the desired end result. But I got frustrated at first as I still saw “noreferrer” in Text/Edit view, but the string of code you provided insinuated that would be the case. Am I in the ballpark here?

    • Yes you are right. If you follow my instructions, the code to remove noreferrer from existing posts will only run on the live site (or preview mode) and not in the editor. That’s how it should be because Amazon doesn’t care about what happens in your editor – only on the live site. I hope that makes it clear… feel free to ask if you have any further questions!

  8. Hi Sara,
    I had no idea this was an issue. I’m so glad I came across your article. Thank you so much for sharing this, and more importantly, for giving such a detailed solution. I’m going to make this change on my websites asap.
    Cheers,
    Sergio

  9. Thank you, Sara, for such a great post. I appreciate the step by step information. I have already taken your information and took care of this on my site.

Previous

6 Real Examples Of Really Successful Affiliate Marketing Websites In 2019

[How To] The 3 Most Valuable Things To Know About Your Competitors

Next