wp_term_is_shared( int $term_id )

Determine whether a term is shared between multiple taxonomies.


Description Description

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.


Parameters Parameters

$term_id

(int) (Required) Term ID.


Top ↑

Return Return

(bool) Returns false if a term is not shared between multiple taxonomies or if splittng shared taxonomy terms is finished.


Top ↑

Source Source

File: wp-includes/taxonomy.php

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;
}

Top ↑

Changelog Changelog

Changelog
Version Description
4.4.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.