is_term

函式
is_term ( $term, $taxonomy = '', $parent = 0 )
引數
  • (int|string) $term The term to check
    Required:
  • (string) $taxonomy The taxonomy name to use
    Required:
    Default: (empty)
  • (int) $parent ID of parent term under which to confine the exists search.
    Required:
返回值
  • (mixed) Get the term ID or term object, if exists.
相關
  • term_exists()
定義位置
相關方法
has_termis_timeis_yearis_dateis_email
引入
2.3.0
棄用
3.0.0

is_term是一個WordPress函式,它檢查給定的ID是否是指定分類法中的一個術語。它需要兩個引數,術語的ID和分類法的名稱。如果該術語在指定的分類法中,它返回一個布林值true,否則返回false。

檢查Term是否存在。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function is_term( $term, $taxonomy = '', $parent = 0 ) {
_deprecated_function( __FUNCTION__, '3.0.0', 'term_exists()' );
return term_exists( $term, $taxonomy, $parent );
}
function is_term( $term, $taxonomy = '', $parent = 0 ) { _deprecated_function( __FUNCTION__, '3.0.0', 'term_exists()' ); return term_exists( $term, $taxonomy, $parent ); }
function is_term( $term, $taxonomy = '', $parent = 0 ) {
	_deprecated_function( __FUNCTION__, '3.0.0', 'term_exists()' );
	return term_exists( $term, $taxonomy, $parent );
}

常見問題

FAQs
檢視更多 >