wp_get_split_term

函式
wp_get_split_term ( $old_term_id, $taxonomy )
引數
  • (int) $old_term_id Term ID. This is the old, pre-split term ID.
    Required:
  • (string) $taxonomy Taxonomy that the term belongs to.
    Required:
返回值
  • (int|false) If a previously split term is found corresponding to the old term_id and taxonomy, the new term_id will be returned. If no previously split term is found matching the parameters, returns false.
定義位置
相關方法
wp_get_split_termswp_get_post_terms_wp_batch_split_termswp_set_post_termswp_get_sites
引入
4.2.0
棄用
-

wp_get_split_term: 這個函式為分層分類法中的某個術語檢索父術語ID和當前術語ID。它接受兩個引數 – 當前術語ID和分類法的名稱。它返回一個有兩個元素的陣列–父術語ID和當前術語ID。

獲取與之前拆分的術語對應的新術語ID。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function wp_get_split_term( $old_term_id, $taxonomy ) {
$split_terms = wp_get_split_terms( $old_term_id );
$term_id = false;
if ( isset( $split_terms[ $taxonomy ] ) ) {
$term_id = (int) $split_terms[ $taxonomy ];
}
return $term_id;
}
function wp_get_split_term( $old_term_id, $taxonomy ) { $split_terms = wp_get_split_terms( $old_term_id ); $term_id = false; if ( isset( $split_terms[ $taxonomy ] ) ) { $term_id = (int) $split_terms[ $taxonomy ]; } return $term_id; }
function wp_get_split_term( $old_term_id, $taxonomy ) {
	$split_terms = wp_get_split_terms( $old_term_id );

	$term_id = false;
	if ( isset( $split_terms[ $taxonomy ] ) ) {
		$term_id = (int) $split_terms[ $taxonomy ];
	}

	return $term_id;
}

常見問題

FAQs
檢視更多 >