taxonomy_exists

函式
taxonomy_exists ( $taxonomy )
引數
  • (string) $taxonomy Name of taxonomy object.
    Required:
返回值
  • (bool) Whether the taxonomy exists.
定義位置
相關方法
tag_existsterm_existscategory_existsget_taxonomy_labelsdomain_exists
引入
3.0.0
棄用
-

taxonomy_exists: 這個函式檢查一個分類法是否存在。

判斷分類法名稱是否存在。

前身是is_taxonomy(),在2.3.0中引入。

關於這個和類似的主題函式的更多資訊,請檢視《主題開發者手冊》中的{@link Conditional Tags}一文。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function taxonomy_exists( $taxonomy ) {
global $wp_taxonomies;
return is_string( $taxonomy ) && isset( $wp_taxonomies[ $taxonomy ] );
}
function taxonomy_exists( $taxonomy ) { global $wp_taxonomies; return is_string( $taxonomy ) && isset( $wp_taxonomies[ $taxonomy ] ); }
function taxonomy_exists( $taxonomy ) {
	global $wp_taxonomies;

	return is_string( $taxonomy ) && isset( $wp_taxonomies[ $taxonomy ] );
}

常見問題

FAQs
檢視更多 >