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
查看更多 >