wpseek.com
WordPress开发者和主题制作者的搜索引擎



wp_term_is_shared › WordPress Function

Since4.4.0
已弃用n/a
wp_term_is_shared ( $term_id )
参数:
  • (int) $term_id Term ID.
    Required: Yes
返回:
  • (bool) Returns false if a term is not shared between multiple taxonomies or if splitting shared taxonomy terms is finished.
定义在:
文档:

Determines whether a term is shared between multiple taxonomies.

Shared taxonomy terms began to be split in 4.3, but failed cron tasks or other delays in upgrade routines may cause shared terms to remain.


源码

function wp_term_is_shared( $term_id ) {
	global $wpdb;

	if ( get_option( 'finished_splitting_shared_terms' ) ) {
		return false;
	}

	$tt_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_taxonomy WHERE term_id = %d", $term_id ) );

	return $tt_count > 1;
}