是否存在名为$ tag的已注册短代码
原型
shortcode_exists( string $tag )
参数
$tag
(string)
(Required)
要检查的短代码标签。
返回值
(bool)
是否存在给定的短代码。
源文件
路径:wp-includes/shortcodes.php
<?php
...
function shortcode_exists( $tag ) {
global $shortcode_tags;
return array_key_exists( $tag, $shortcode_tags );
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/shortcode_exists/