转义HTML标记名称。

原型

tag_escape( string $tag_name )

参数

$tag_name (string) (Required)

返回值

(string)  

源文件

路径:wp-includes/formatting.php

<?php
...
function tag_escape( $tag_name ) {
	$safe_tag = strtolower( preg_replace('/[^a-zA-Z0-9_:]/', '', $tag_name) );
	/**
	 * Filters a string cleaned and escaped for output as an HTML tag.
	 *
	 * @since 2.8.0
	 *
	 * @param string $safe_tag The tag name after it has been escaped.
 	 * @param string $tag_name The text before it was escaped.
	 */
	return apply_filters( 'tag_escape', $safe_tag, $tag_name );
}
...
?>

其他

英文文档:https://developer.wordpress.org/reference/functions/tag_escape/