tag_exists

函式
tag_exists ( $tag_name )
引數
  • (int|string) $tag_name
    Required:
返回值
  • (mixed) Returns null if the term does not exist. Returns an array of the term ID and the term taxonomy ID if the pairing exists. Returns 0 if term ID 0 is passed to the function.
定義位置
相關方法
post_existsterm_existsemail_existsmetadata_existscategory_exists
引入
2.3.0
棄用
-

tag_exists: 這是一個WordPress的函式,用於檢查一個具有指定名稱的標籤是否存在: 這個函式只需要一個引數,即你想檢查的標籤名稱。如果標籤存在,這個函式返回標籤的ID。如果標籤不存在,該函式返回false。

檢查具有給定名稱的文章標籤是否存在。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function tag_exists( $tag_name ) {
return term_exists( $tag_name, 'post_tag' );
}
function tag_exists( $tag_name ) { return term_exists( $tag_name, 'post_tag' ); }
function tag_exists( $tag_name ) {
	return term_exists( $tag_name, 'post_tag' );
}

常見問題

FAQs
檢視更多 >