Adding nofollow attribute to your WordPress blogroll
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.
Thumbnail from here.
If you enjoyed this article, please consider sharing it!
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.