wp_rel_nofollow

The timeline below displays how wordpress function wp_rel_nofollow has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 5.9

/**
 * Adds `rel="nofollow"` string to all HTML A elements in content.
 *
 * @since 1.5.0
 *
 * @param string $text Content that may contain HTML A elements.
 * @return string Converted content.
 */
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', static function ($matches) {
        return wp_rel_callback($matches, 'nofollow');
    }, $text);
    return wp_slash($text);
}

WordPress Version: 5.3

/**
 * Adds `rel="nofollow"` string to all HTML A elements in content.
 *
 * @since 1.5.0
 *
 * @param string $text Content that may contain HTML A elements.
 * @return string Converted content.
 */
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);
}

WordPress Version: 4.3

/**
 * Adds rel nofollow string to all HTML A elements in content.
 *
 * @since 1.5.0
 *
 * @param string $text Content that may contain HTML A elements.
 * @return string Converted content.
 */
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', 'wp_rel_nofollow_callback', $text);
    return wp_slash($text);
}

WordPress Version: 3.7

/**
 * Adds rel nofollow string to all HTML A elements in content.
 *
 * @since 1.5.0
 *
 * @param string $text Content that may contain HTML A elements.
 * @return string Converted content.
 */
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', 'wp_rel_nofollow_callback', $text);
    $text = wp_slash($text);
    return $text;
}