Google wants paid links marked with rel="sponsored", and most people running paid posts never do it. When I audited a radio station website I run, I found about 2,280 sponsored posts and only 7 of them had their paid links marked. This is what the attribute is for, when to use the other two, and a small PHP function I wrote to add it automatically.

The three values, in Google’s words
Google’s page on qualifying outbound links gives each value one job:
- sponsored: “Mark links that are advertisements or paid placements (commonly called paid links)”. If money or a freebie changed hands, this is the one.
- ugc: links in user-generated content, such as comments and forum posts.
- nofollow: the catch-all for when the others don’t apply and you’d rather Google didn’t associate your site with the page you’re linking to.
You can combine them, so rel="sponsored nofollow" is allowed. Google says links marked this way will “generally not be followed”, which is a polite way of saying they are hints and not commands.
What I found on my own site
A paid link with no attribute passes ranking credit, and that is the thing Google’s link spam rules are aimed at. I knew we took paid guest posts. I did NOT know how few of them had the attribute until I counted: 7 out of about 2,280.
Adding it automatically
Editing 2,280 posts is the wrong answer. The better one is to add the attribute when the page is displayed, so the stored posts stay untouched. This function takes the post HTML and your own domain, leaves internal links alone, adds sponsored to every external link and keeps any rel value that was already there.
<?php
function add_sponsored_rel($html, $siteHost)
{
return preg_replace_callback('/<a\s[^>]*href=("|\')(.*?)\1[^>]*>/i', function ($m) use ($siteHost) {
$tag = $m[0];
$host = parse_url($m[2], PHP_URL_HOST);
if (!$host || strcasecmp(preg_replace('/^www\./i', '', $host), $siteHost) === 0) {
return $tag;
}
if (preg_match('/\srel=("|\')(.*?)\1/i', $tag, $r)) {
$values = preg_split('/\s+/', trim($r[2]));
if (in_array('sponsored', $values, true)) return $tag;
$values[] = 'sponsored';
return str_replace($r[0], ' rel="' . implode(' ', $values) . '"', $tag);
}
return substr($tag, 0, -1) . ' rel="sponsored">';
}, $html);
}
I ran it on a sample paragraph with 6 links: an external link, a relative link, a link to my own domain with www., an external link that already had rel="noopener", one already marked sponsored, and one with single quotes. The result was what I wanted: the 4 external links ended up with sponsored (noopener sponsored on the one that had noopener), the 2 own-site links were untouched, and running it twice gave the same output as running it once, so a double filter can’t pile up duplicates.
To use it in WordPress you would hook it onto the_content for the category your paid posts live in. I have tested the function on its own, but I haven’t switched it on across the site yet, because it changes what the buyers of those links get for their money. My decision is to switch it on only for sponsored posts that are past their 12 months and already noindexed, where the buyer gets almost nothing from the link anyway, and to leave the newer ones alone for now. That is a compromise, and I’ll review it again on 1 December.
My rule of thumb
Paid or free product in return: sponsored. Comments and forums: ugc. A link you don’t want to vouch for and nobody paid for: nofollow. If you can’t decide, ask whether you would link to it if nobody had offered you anything. If the answer is no, it needs marking!