shortcode_exists

函式
shortcode_exists ( $tag )
引數
  • (string) $tag Shortcode tag to check.
    Required:
返回值
  • (bool) Whether the given shortcode exists.
定義位置
相關方法
shortcode_attsshortcode_parse_attsget_shortcode_regexdo_shortcode_tagpost_exists
引入
3.6.0
棄用
-

shortcode_exists: 這是一個WordPress函式,用於檢查一個給定的短碼是否存在。它通常被用來確定一個短碼是否可以在一個特定的環境中使用: 這個函式需要一個引數,就是短碼的名稱。

確定是否存在一個名為$tag的註冊短碼。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function shortcode_exists( $tag ) {
global $shortcode_tags;
return array_key_exists( $tag, $shortcode_tags );
}
function shortcode_exists( $tag ) { global $shortcode_tags; return array_key_exists( $tag, $shortcode_tags ); }
function shortcode_exists( $tag ) {
	global $shortcode_tags;
	return array_key_exists( $tag, $shortcode_tags );
}

常見問題

FAQs
檢視更多 >