November 21st, 2007

How to add nofollow to wordpress blogroll links

So I recently discovered that my site had dropped for PageRank 5 to a PageRank 3. I looked into it, and I still have lots of links coming to my site. It appears that I was penalized by Google, and it seems to be because I had some paid links on my homepage. So, I decided to add rel="nofollow" to the links. The only problem is that when you try to do this with the Blogroll editor in WordPress, there is no nofollow option. So I had to add one.

If you wish to do the same, it's quite easy. Just find the /wp-admin/edit-link-form.php file, create a backup copy of it, and modify it. Look for lines 113 and 114, which should look like:

<tr>
        <th scope="row"> <?php _e('identity') ?> </th>

And add this code before it:

<tr>
        <th scope="row"> nofollow </th>
        <td>
                <label for="nofo">
                <input class="valinp" type="checkbox" name="nofo" value="nofollow" id="nofo" <?php xfn_check('nofo', 'nofollow'); ?> />
                nofollow</label>
        </td>
</tr>

You'll now be able to edit your blogroll links and add rel="nofollow" to any you wish.

14 Responses to ' How to add nofollow to wordpress blogroll links '

Subscribe to comments with RSS or TrackBack to ' How to add nofollow to wordpress blogroll links '.


  1. on December 19th, 2007 at 10:39 pm

    Dude, thanks! You are a genious..:)

  2. Paul said,

    on January 8th, 2008 at 6:29 pm

    What more can I say? It works - unlike other hacks - straight out of the box. Now I can rest easy at night! Thanks.

  3. Leona said,

    on January 14th, 2008 at 3:39 am

    Doesn't seem to work for me…I get an error on the page saying there exists an extra { in line 1 … some stuff like that even after checking several times…

  4. JustinM said,

    on January 24th, 2008 at 9:36 pm

    Thank you for this.

  5. Tom said,

    on January 25th, 2008 at 8:09 am

    I was looking for that for quite a long time, Thanks !

  6. Senthil said,

    on January 27th, 2008 at 5:51 am

    Is having any plugin available to add no follow in blogroll without touching Wp Core files ???

  7. Bloguitar said,

    on February 1st, 2008 at 3:47 am

    Works perfect, thanks!

  8. mattg said,

    on February 3rd, 2008 at 9:05 pm

    Hi Justin,

    looks like the big G still isn't happy with you, you've got PR0 now…

    just got the same for one of my blogs in the recent update, and I'm guessing it's because I've got blogroll links to other sites of mine that aren't "nofollow"'d..

    thanks for the code, gonna go try it out now..
    :)
    Mattg


  9. on February 19th, 2008 at 12:31 pm

    Thanks! This is exactly what I was looking for.. Do you know if edit-link-form.php gets overwritten when installing new versions of Wordpress?

  10. James Morris said,

    on March 4th, 2008 at 5:19 pm

    Senthil I wrote a plugin for this, get it here wordpress blogroll nofollow.


  11. on March 6th, 2008 at 6:24 pm

    Thanks … this is one hack that worth it's weight in Gold … Great contribution …

    Edward

  12. simon said,

    on March 17th, 2008 at 8:13 am

    Is it a must to add no follow to blogrolls for Google?


  13. on April 30th, 2008 at 11:22 am

    Hey man, thanks for the code.

    Just to update, I'm using 2.5.1
    the lines that need to be edited is now on 165 to 166. :)

    Simon, yes, preferably, lower your PR, slower your pages get indexed, you want to absorb all of the PR as much as possible.

  14. Sujay said,

    on May 2nd, 2008 at 5:00 am

    Thanks for the lucid explanation :)

Leave a reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture.
Anti-Spam Image