wp_rel_ugc

函数
wp_rel_ugc ( $text )
参数
  • (string) $text Content that may contain HTML A elements.
    Required:
返回值
  • (string) Converted content.
定义位置
相关方法
wp_rel_callbackwp_parse_urlwp_create_tagwp_parse_argswp_list_pluck
引入
5.3.0
弃用
-

wp_rel_ugc: 这个函数用于为一个链接添加rel=”ugc”属性。它接受几个参数,包括链接的属性。

为内容中的所有HTML A元素添加`rel="nofollow ugc"`字符串。

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 );
}

常见问题

FAQs
查看更多 >
闪电侠

(工作日 10:00 - 18:30 为您服务)

2025-12-05 18:32:58

您好,无论是售前、售后、意见建议……均可通过联系工单与我们取得联系。

您也可选择聊天工具与我们即时沟通或点击查看:

您的工单我们已经收到,我们将会尽快跟您联系!
取消
选择聊天工具: