allowed_tags

函数
allowed_tags ( No parameters )
返回值
  • (string) HTML allowed tags entity encoded.
定义位置
相关方法
get_allowed_themesadd_allowed_optionswp_allowed_protocolsbalancetagsget_allowed_http_origins
引入
1.0.1
弃用
-

allowed_tags: 这是一个WordPress的函数,它返回一个允许的HTML标签和属性数组,用于wp_kses函数。

以HTML格式显示所有允许的标签和属性。

这对在评论区显示哪些元素和属性是支持的很有用。以及任何想要显示它的插件。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function allowed_tags() {
global $allowedtags;
$allowed = '';
foreach ( (array) $allowedtags as $tag => $attributes ) {
$allowed .= '<' . $tag;
if ( 0 < count( $attributes ) ) {
foreach ( $attributes as $attribute => $limits ) {
$allowed .= ' ' . $attribute . '=""';
}
}
$allowed .= '> ';
}
return htmlentities( $allowed );
}
function allowed_tags() { global $allowedtags; $allowed = ''; foreach ( (array) $allowedtags as $tag => $attributes ) { $allowed .= '<' . $tag; if ( 0 < count( $attributes ) ) { foreach ( $attributes as $attribute => $limits ) { $allowed .= ' ' . $attribute . '=""'; } } $allowed .= '> '; } return htmlentities( $allowed ); }
function allowed_tags() {
	global $allowedtags;
	$allowed = '';
	foreach ( (array) $allowedtags as $tag => $attributes ) {
		$allowed .= '<' . $tag;
		if ( 0 < count( $attributes ) ) {
			foreach ( $attributes as $attribute => $limits ) {
				$allowed .= ' ' . $attribute . '=""';
			}
		}
		$allowed .= '> ';
	}
	return htmlentities( $allowed );
}

常见问题

FAQs
查看更多 >