Making RSS Feed Links no-follow in WordPress Sidebar

If you use the RSS widget in WordPress to bring in a Feed with multiple external links that go to external content and that update in the sidebar.  You may notice that all these links have the attribute set to ‘follow‘ by default.

This can be detrimental to your page’s SEO status in terms of page authority and distribution of PageRank – the best thing is to switch these links to the attribute of ‘no-follow’. This is done by editing one of the core WordPress files, the only thing you have to remember is to check when you upgrade WordPress that the change is not overwritten in which case you will have to apply the change again.

Open default-widgets.php in the document root under wp-includes/

public_html/wp-includes/default-widgets.php

The link attribute we need to add in 3 times is:

rel='nofollow'

Either replace the whole line or just add in where it is positioned below:

Line 768 needs it twice

$title = "<a class='rsswidget' href='$url' rel='nofollow' title='" . esc_attr__( 'Syndicate this content' ) ."'><img style='border:0' width='14' height='14' src='$icon' alt='RSS' /></a> <a class='rsswidget' href='$link' rel='nofollow' title='$desc'>$title</a>";

Line 886 needs one occurrence

echo "<li><a class='rsswidget' href='$link' rel='nofollow' title='$desc'>$title</a>{$date}{$summary}{$author}</li>";

3 Comments

  1. Jakub on June 1, 2017 at 9:51 pm

    Hello Szymon. Did you manage to solve this problem. Could you please share it how to fix it

  2. Szymon on October 16, 2016 at 11:53 pm

    I found it in includes/widgets.php

  3. Szymon on October 16, 2016 at 11:40 pm

    Hi,

    Line 886 doesnt exist in any rss widget file. I coudnt even find echo url for list items

    Do you know how to make it in the newest wordpress ?

Leave all Comment