WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I add a nofollow option to my blogroll links editor?

Attempted to just type "nofollow" into the "rel" input box, but its auto deleted onblur.

If I turn javascript off (thanks to Matt's suggestion below), It works, but when I check the source on my site, the rel attribute looks like this...


share|improve this question
Are you just trying to nofollow certain links, or add a nofollow across the board? Its simple enough to filter the output of wp list bookmarks if that meets your needs... – goldenapples Dec 9 '10 at 1:51
all my blogroll links need to be nofollow – Scott B Dec 9 '10 at 1:54
up vote 2 down vote accepted

I know of three ways around this and unfortunately they all suck:

  1. Hack a core file
  2. Use a plugin
  3. Temporarily turn off scripgs in your browser and change them in the edit links section.
share|improve this answer
Of those, I like #3 best – Scott B Dec 9 '10 at 1:55
How difficult would it be to add an option for "nofollow" to the Link editor's existing "Link Relationship(XFN) options list? – Scott B Dec 10 '10 at 17:09
I think that's worthy of a new question. It would be possible assuming theres a way to hook into it. I don't know how but someone on here might. – matt Dec 10 '10 at 17:36

You can filter your blogroll to make all links nofollow with a function like this:

function nofollow_blogroll( $html ) {
    // remove existing rel attributes
    $html = preg_replace( '/\s?rel=".*"/', '', $html );
    // add rel="nofollow" to all links
    $html = str_replace( '<a ', '<a rel="nofollow" ', $html );
    return $html;
add_filter( 'wp_list_bookmarks', 'nofollow_blogroll' );

If you need to do it on a case-by-case basis, though, you're probably stuck with some hacks like @matt pointed out.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.