How To Add “nofollow” To Certain Blogroll Links In WordPress 3.x

ALERT: WE HAVE MOVED TO http://codingmassacre.com/!!

Earlier today I was looking on how to add “rel=nofollow” to only a few of the links to my WordPress blogroll. I came across outdated instructions, as WordPress has since changed some of their php files. After doing some searching on how to add the nofollow tag to whatever blogroll links you want I have come up with an answer.

In your website’s server go to /wp-admin/includes/. Look for meta-boxes.php. If you’re on WordPress 3.2 on line 857 add the following code. If you’re on WordPress 3.3 it’ll go on line 871.

 <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> 

(or get the code from Pastebin here

After that save the file and put the updated version with the new code onto your server, overwriting the old file. From then go to your website’s wp-admin/link-manager.php Go to edit an individual link. At the bottom of the Link Relationship (XFN) you will see a nofollow box.

Check it. Then click update link. You’ve then successfully added the nofollow tag to that individual blogroll link! A quick look at the source code for your website will verify that it’s been done correctly.

Please note whenever you update WordPress you will have to re-add the code. If you are looking for an easy way to do it to all your blogroll links simply install a plugin such as Blogroll Nofollow.

Advertisements

6 thoughts on “How To Add “nofollow” To Certain Blogroll Links In WordPress 3.x

  1. Thanks so much for this! I’ve wanted to add the nofollow attribute to selected links for a while now. All the plugins out there that I could find make ALL blogroll links nofollow.
    Seems like an options that should be in the default ‘rel’ list in the core of WordPress.
    Going to put a post about this on my blog for future reference as I’m sure I’ll need it later!

  2. Hey,

    Thanks brilliant work !!!

    I’ve been looking for something like this for ages.

    Got a question to ask as well, do you have any idea how you can amend multiple h1 tags on a wordpress site without changing the format of those words.

    Thanks in advance

Leave a Reply to Trainman1405 Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s