Uses
| Uses | Description |
|---|---|
| wp-includes/formatting.php: wp_rel_callback() | Callback to add a rel attribute to HTML A element. |
| wp-includes/formatting.php: wp_slash() | Add slashes to a string or array of strings, in a recursive manner. |
Adds rel="nofollow ugc" string to all HTML A elements in content.
(string) (Required) Content that may contain HTML A elements.
(string) Converted content.
File: wp-includes/formatting.php
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',
function( $matches ) {
return wp_rel_callback( $matches, 'nofollow ugc' );
},
$text
);
return wp_slash( $text );
} | Version | Description |
|---|---|
| 5.3.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_rel_ugc