If you want to add the “nofollow” attribute to any link in your blogroll (and you should do this if your links come from paid sources or if you want to limit the flow of pagerank) without using a plugin here’s quick tutorial as to how you can add this attribute to your WordPress installation (WordPress 2.9+).
Note: If you use a version older than WordPress 2.9 this method will not work. Check this website for a method that works with older installs, or upgrade to the latest version.
Warning: before you start please make a backup of the files that you’re going to edit.
How to add nofollow to WordPress Blog links
If you’re a beginner you’ll get your hands a little dirty but it’s not so hard afterall, you’ll see.
1. Navigate to your wordpress install folder and open the file /wp-admin/includes/meta-boxes.php.
2. Go to line 675 and you should see somethink like this:
<tr>
<th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('identity') ?> </th>3. Now, just before this line add this piece of code:
<tr>
<th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('Seo') ?> </th>
<td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('nofollow') ?> </span></legend>
<label for="nofollow">
<input class="valinp" type="checkbox" name="nofollow" value="nofollow" id="nofollow" <?php xfn_check('Seo', 'nofollow'); ?> />
<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('nofollow') ?></label>
</fieldset></td>
</tr>
Save your file and go to the Links section from your WordPress Dashboard. If you edit or add a new link, you’ll see that the “Seo” option with the “nofollow” attribute is the first attribute in the Link Relationships (XFN) section.
Hope you’ve enjoyed this. Cheers.





14 Comments on "Adding nofollow attribute to your WordPress blogroll"
Hi! Thanks for sharing this – it’s the first article I find on the topic that relates in some way to post-WP2.9 development. I’m currently working with WP2.9.2 as the latest WP build and although adding the code does the trick and inserts in the link section of the dashboard the nofollow rel in the relationship panel, it does not stay checked after updating the link. Nor does it do the trick, since the rel column in the edit link panel stays empty. I’d be grateful if you shared your thoughts on how to overcome that. I’m kind of new to this stuff, I can follow directions pretty easily, but thinking it up myself does not yet work. Thanks again!
Hi, thanks for noticing that. By mistake I wrote line 676 instead of 675. I’ve changed the error now.
So, go on line 675 and just before it (see the example again) add the code again and please tell me if it worked.
Cheers.
Works like a marvel! Thanks for your help!
Thanks! Worked perfectly. It is a feature that I have wanted for awhile. Many man thanks!
Oops. supposed to have read “many many thanks!”
Amiable fill someone in on and this enter helped me alot in my college assignement. Gratefulness you seeking your information.
Dude, I was using google for this for hours and all other ways of doing this failed but yours didn’t. You are the man! THANK YOU
This is superb. I hate using plugins for doing every little thing like adding “nofollow” to selected URLs in my blogroll. I Googgled for days to find a solution but all of them were focused on older versions of WordPress and didn’t work for 3.0
But this solution you have provided here works like a miracle.
Ohhh… Sorry it works for WP 3.0.1 (latest version at the time of this writing) – that’s what I am using… not sure if it works with 3.0
I have WP 3.0.1 and line 675 doesn’t look like that on mine. I’m a total newbie. Please help
Hi. In WP 3.0.1 go to line 738 instead and just after that line add the code.
Thank you Skat. :)
works great in wp 3.01. thanks a lot. hey folks dont forget after updating your wordpress to ‘reinstall’ this snippet of code.
Just wanted to pop in and say thanks a bunch for this fix, I can’t believe it isn’t part of the core. Works fine with wp 3.03.