dofollow in WordPress ohne Plugin

wordpress logo dofollow in Wordpress ohne PluginDie Diskussion, ob Links in Kommentaren nun dofollow oder nofollow gekennzeichnet sein sollten, ist fast so alt wie die Geschichte mit der Henne und dem Ei. Wir für unseren Teil halten es mit dofollow.

Inzwischen gibt es einige WordPress Plugins, die das Setzten von dofollow unterstützen. Ich für meinen Teil wollte das ganze lieber ohne Plugin umsetzen und bin nach längerer Suche bei CrazyToast fündig geworden. Wer das ganze für Seinen Blog übernehmen möchte, kann folgende code Zeilen in die functions.php einfügen.

/**
 * Enable dofollow from 3 Comment + manual dontfollow 
 * Found it on http://www.crazytoast.de
**/
function strip_nofollow($ret) {
	global $wpdb, $comment;
	$queryString="SELECT COUNT(*) as comments FROM ".$wpdb->comments." WHERE comment_author_url='".$wpdb->escape($comment->comment_author_url)."'";
	$comments_count = $wpdb->get_var($queryString);
	if ($comment->comment_type == "pingback" || $comment->comment_type == "trackback") {
		$ret = str_replace("rel='external nofollow'","rel='external'", $ret);
		return $ret;
	}
	$cmntURL = $comment->comment_author_url;
	$dontfollow_link = stristr($cmntURL, 'dontfollow');
	if ($comments_count >= 3 & $dontfollow_link === FALSE) {
		$ret = str_replace("rel='external nofollow'","rel='external'", $ret);
		return $ret;
	} else {
		$ret = str_ireplace("/dontfollow", "/", $ret);
		return $ret;
	}
}
add_filter('get_comment_author_link', 'strip_nofollow');

wallpaper-1019588
Die richtige Matratze für erholsamen Schlaf
wallpaper-1019588
Die Hallmarks of Aging – Wie Altern biologisch entsteht und warum wir es beeinflussen können
wallpaper-1019588
Vegas Mafia King von Jessica Graves und Nella Bay
wallpaper-1019588
Algarve News vom 15. bis 21. Dezember 2025
wallpaper-1019588
[Manga] Vagabond [5]