diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index a5eddae784..1c94f2906e 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -2835,7 +2835,24 @@ function _make_url_clickable_cb( $matches ) { return $matches[0]; } - return $matches[1] . "$url" . $suffix; + if ( 'comment_text' === current_filter() ) { + $rel = 'nofollow ugc'; + } else { + $rel = 'nofollow'; + } + + /** + * Filters the rel value that is added to URL matches converted to links. + * + * @since 5.3.0 + * + * @param string $rel The rel value. + * @param string $url The matched URL being converted to a link tag. + */ + $rel = apply_filters( 'make_clickable_rel', $rel, $url ); + $rel = esc_attr( $rel ); + + return $matches[1] . "$url" . $suffix; } /** @@ -2865,7 +2882,17 @@ function _make_web_ftp_clickable_cb( $matches ) { return $matches[0]; } - return $matches[1] . "$dest$ret"; + if ( 'comment_text' === current_filter() ) { + $rel = 'nofollow ugc'; + } else { + $rel = 'nofollow'; + } + + /** This filter is documented in wp-includes/formatting.php */ + $rel = apply_filters( 'make_clickable_rel', $rel, $dest ); + $rel = esc_attr( $rel ); + + return $matches[1] . "$dest$ret"; } /** @@ -3148,7 +3175,7 @@ function wp_targeted_link_rel_callback( $matches ) { * * @since 5.1.0 * - * @param string The rel values. + * @param string $rel The rel values. * @param string $link_html The matched content of the link tag including all HTML attributes. */ $rel = apply_filters( 'wp_targeted_link_rel', 'noopener noreferrer', $link_html ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 28ff42bcd6..786e6f82e8 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.3-RC1-46563'; +$wp_version = '5.3-RC1-46564'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.