DISCLAIMER: this post is older than one year and may not be up to date with latest WordPress version.

By default, WordPress automatically converts all links from the post content to nofollow. If you prefer your links to be dofollow, just read and use the following recipe.

Copy the following code, and paste it on the functions.php file from your theme. Once you saved the file file, the rel=”nofollow” attributes will be removed.

function remove_nofollow($string) {
	$string = str_ireplace(' rel="nofollow"', '', $string);
	return $string;
}
add_filter('the_content', 'remove_nofollow');

Thanks to Jeff Starr for this awesome piece of code. Have you checked out the book Jeff wrote with Chris Coyier? It’s called Digging into WordPress and it is great!

Tags

4 Comments

  1. A bit confused. WordPress doesn’t use nofollow in post content only comments. Was there a change?

  2. I added this code to fundtions.php, but the nofollows remain and continue to get added to new posts. Does it need to be in a certain location in functions.php? Is it supposed to remove from old posts, or just not add to new posts?

    Thanks for any help.

    Bill

  3. Thank alot. This is very useful and just what i was locking for, for my SEO.
    I will add this to my wordpress blog... :)

  4. how to make all internal links dofollow

Leave a Comment

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