/** * Return the current term taxonomy ID for the given site and the given term ID in the current site. * * @param int $site_id Blog ID. * @param int $term_id Term ID of the currently edited term. * * @return int */ public function get_current_term($site_id, $term_id) { $term = $this->get_term_from_site($term_id); if (!isset($term->term_taxonomy_id)) { return 0; } if (!isset($this->site_terms[$term->term_taxonomy_id][$site_id])) { $term_taxonomy_id = $this->content_relations->get_element_for_site($this->current_site_id, $site_id, $term->term_taxonomy_id, 'term'); if ($term_taxonomy_id) { $this->site_terms[$term->term_taxonomy_id][$site_id] = $term_taxonomy_id; } } if (empty($this->site_terms[$term->term_taxonomy_id][$site_id])) { return 0; } return $this->site_terms[$term->term_taxonomy_id][$site_id]; }