Free code

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.

Share

29 Comments

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

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

  3. 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. Thank you for this.

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

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

  7. Works perfect, thanks!

  8. 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. 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. Senthil I wrote a plugin for this, get it here wordpress blogroll nofollow.

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

    Edward

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

  13. 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. Thanks for the lucid explanation 🙂

  15. Thanks for sharing. Been looking for something like this for my blog. Need to put it up.

  16. Absolutely brilliant!

  17. This is exactly what I've been looking for so long time. I was unable to add "nofollow" relationship to a blogroll link, till now. Thanks for this.

  18. In case anyone was wondering… most of the hacks don't work for WP 2.7 – but I found a plugin now that works even better and allows you to simply select which links you wish to add NOFOLLOW tags to. Here is the link:

    http://wordpress.org/extend/plugins/nofollow-links/

  19. Simply great my friend.

  20. you're brilliant! thanks so much for this, simple and works great!

  21. Setting nofollow for links in a WordPress blog | 2Bro Web Support

    […] how-to-add-nofollow-to-wordpress-blogroll-links […]

  22. Works perfect, thanks!

  23. You rock man..thanks a ton!

  24. How to create nofollow links | BlogWell

    […] How to add nofollow to WordPress blogroll links […]

  25. Hey, thanks a lot! WordPress is sometimes a mystery for me but this post REALLY helped! Let's just hope no-one gets mad becaused I "no-followed" them. 😉

  26. Any idea how to do this with other widgets? I want to nofollow the links in my "pages" widget, and other widgets for that matter. Thanks!

  27. Maybe thats me but with WordPress 3 they changed the way boxes are displayed
    I have that instead in the file :

    add_meta_box('linksubmitdiv', __('Save'), 'link_submit_meta_box', 'link', 'side', 'core');
    add_meta_box('linkcategorydiv', __('Categories'), 'link_categories_meta_box', 'link', 'normal', 'core');
    add_meta_box('linktargetdiv', __('Target'), 'link_target_meta_box', 'link', 'normal', 'core');
    add_meta_box('linkxfndiv', __('Link Relationship (XFN)'), 'link_xfn_meta_box', 'link', 'normal', 'core');
    add_meta_box('linkadvanceddiv', __('Advanced'), 'link_advanced_meta_box', 'link', 'normal', 'core');

    Any solution ?

  28. making money online at home

    Good topic Justin. You just solve my problem. I will definitely use your code.

    Thanks for sharing this,
    Abhijit..

  29. Thanks for this. I need to have nofollow for my pages 😀 This was perfect

Leave a Reply

Your email address will not be published. Required fields are marked *

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Anti-spam image