protected function get_term($tid)
{
if (is_object($tid) || is_array($tid)) {
return $tid;
}
$tid = self::get_tid($tid);
if (isset($this->taxonomy) && strlen($this->taxonomy)) {
return get_term($tid, $this->taxonomy);
} else {
global $wpdb;
$query = $wpdb->prepare("SELECT taxonomy FROM {$wpdb->term_taxonomy} WHERE term_id = %d LIMIT 1", $tid);
$tax = $wpdb->get_var($query);
if (isset($tax) && strlen($tax)) {
$this->taxonomy = $tax;
return get_term($tid, $tax);
}
}
return null;
}