How to automatically remove the Nofollow from your posts

February 3, 2010 at 9:00 am

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: