function wp_rel_nofollow_callback( $matches ) {}

Callback to used to add rel=nofollow string to HTML A element.
Will remove already existing rel="nofollow" and rel=’nofollow’ from the string to prevent from invalidating (X)HTML.


  • array $matches: Single Match

Return values

returns:HTML A Element with rel nofollow.

Source code

function wp_rel_nofollow_callback( $matches ) {

	$text = $matches[1];

	$text = str_replace(array(' rel="nofollow"', " rel='nofollow'"), '', $text);

	return "<a $text rel=\"nofollow\">";



No comments yet... Be the first to leave a reply!

Leave a 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 )

Facebook photo

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

Connecting to %s

%d bloggers like this: