On this page
wp_rel_ugc( string $text ): string
Adds rel="nofollow ugc" string to all HTML A elements in content.
Parameters
$textstring Required-
Content that may contain HTML A elements.
Return
string Converted content.
Source
File: wp-includes/formatting.php. View all references
function wp_rel_ugc( $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 ugc' );
},
$text
);
return wp_slash( $text );
}
Related
Uses
| Uses | Description |
|---|---|
| wp_rel_callback() wp-includes/formatting.php | Callback to add a rel attribute to HTML A element. |
| wp_slash() wp-includes/formatting.php | Adds slashes to a string or recursively adds slashes to strings within an array. |
Changelog
| Version | Description |
|---|---|
| 5.3.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_rel_ugc