wp_get_split_terms

函式
wp_get_split_terms ( $old_term_id )
引數
  • (int) $old_term_id Term ID. This is the old, pre-split term ID.
    Required:
返回值
  • (array) Array of new term IDs, keyed by taxonomy.
定義位置
相關方法
wp_get_split_termwp_get_post_terms_wp_batch_split_termswp_get_siteswp_set_post_terms
引入
4.2.0
棄用
-

wp_get_split_terms: 這個函式檢索分層分類法中給定術語的父術語和所有子術語。它接受兩個引數 – 父術語ID和分類法的名稱。它返回一個WP_Term物件的陣列。

獲取以前共享一個術語_id,但後來被拆分的術語的資料。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function wp_get_split_terms( $old_term_id ) {
$split_terms = get_option( '_split_terms', array() );
$terms = array();
if ( isset( $split_terms[ $old_term_id ] ) ) {
$terms = $split_terms[ $old_term_id ];
}
return $terms;
}
function wp_get_split_terms( $old_term_id ) { $split_terms = get_option( '_split_terms', array() ); $terms = array(); if ( isset( $split_terms[ $old_term_id ] ) ) { $terms = $split_terms[ $old_term_id ]; } return $terms; }
function wp_get_split_terms( $old_term_id ) {
	$split_terms = get_option( '_split_terms', array() );

	$terms = array();
	if ( isset( $split_terms[ $old_term_id ] ) ) {
		$terms = $split_terms[ $old_term_id ];
	}

	return $terms;
}

常見問題

FAQs
檢視更多 >