A WordPress-centric search engine for devs and theme authors



wp_rel_nofollow ›

Since1.5.0
Deprecatedn/a
wp_rel_nofollow ( $text )
Parameters:
  • (string) $text Content that may contain HTML A elements.
    Required: Yes
Returns:
  • (string) Converted content.
Defined at:
Codex:

Adds `rel="nofollow"` string to all HTML A elements in content.



Source

function wp_rel_nofollow( $text ) {
	// This is a pre-save filter, so text is already escaped.
	$text = stripslashes( $text );
	$text = preg_replace_callback(
		'|<a (.+?)>|i',
		function( $matches ) {
			return wp_rel_callback( $matches, 'nofollow' );
		},
		$text
	);
	return wp_slash( $text );
}