wp_rel_nofollow( string $text )

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

Description Description

Parameters Parameters


(string) (Required) Content that may contain HTML A elements.

Top ↑

Return Return

(string) Converted content.

Top ↑

Source Source

File: wp-includes/formatting.php

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' );
	return wp_slash( $text );

Top ↑

Changelog Changelog

Version Description
1.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.