Retrieve a taxonomy term.

@param integer $termId
@param string  $taxonomy

@return array

@link http://codex.wordpress.org/XML-RPC_WordPress_API/Taxonomies#wp.getTerm
356013
function getTerm($termId, $taxonomy)
    {
        $params = array(1, $this->username, $this->password, $taxonomy, $termId);

        return $this->sendRequest('wp.getTerm', $params);
    }
1099656
public function hasTerm($taxonomy, $term)
    {
        return isset($this->terms[$taxonomy]) && isset($this->terms[$taxonomy][$term]);
    }
419119
public function getTerms($vocabulary_id)
    {
        if (!$data = Cache::get($this->getTaxonomyCacheKey())) {
            $data = $this->cacheTermsForContent();
        }

        if (!is_numeric($vocabulary_id)) {
            $vocabulary_id = T::vocabulary($vocabulary_id);
        }

        $results = new Collection();
        if (array_key_exists($vocabulary_id, $data)) {
            foreach ($data[$vocabulary_id] as $term) {
                $results[] = T::getTerm($term);
            }
        }

        return $results;
    }
334646
public function render($termId)
    {
        $meta = $this->taxonomy->getMeta($termId);

        $this->getField()->getManager()->renderPreview(
            Arr::get($meta, $this->path)
        );
    }
775029
public function getTermsAttribute(): array
    {
        $taxonomies = $this->taxonomies;
        foreach ($taxonomies as $taxonomy) {
            $taxonomyName =
                $taxonomy['taxonomy'] === 'post_tag' ? 'tag' : $taxonomy['taxonomy'];
            $terms[$taxonomyName][$taxonomy->term['slug']] = $taxonomy->term->content;
        }

        return $terms ?? [];
    }
289553
public function getRouteParameters($taxonomy)
    {
        $taxonomy = Taxonomy::taxonomy($taxonomy)
                            ->term($this->name)
                            ->with('parent')
                            ->first();

        $parameters = $this->getParentSlugs($taxonomy);

        array_push($parameters, $taxonomy->taxonomy);

        return array_reverse($parameters);
    }
1049649
public function getGlossaryType( $id ) {

		$terms = get_the_terms( $id, 'glossary-type' );
		if ( $terms && ! is_wp_error( $terms ) ) {
			foreach ( $terms as $term ) {
				return $term->slug;
			}
		}

		return 'miscellaneous';
	}
532118
public function getTerm($term, $taxonomy = '', $parent = null)
    {
        $cacheKey = 'term_' . md5(implode('_', func_get_args()));

        if (Cache::tags('taxonomies')->has($cacheKey)) {
            return Cache::tags('taxonomies')->get($cacheKey);
        }

        if (is_int($term)) {
            if ($term == 0) {
                return false;
            }
            $query = $this->termRepository->getTermById($term, $taxonomy, $parent);
        }

        if (is_string($term)) {
            if ($term == '') {
                return false;
            }
            if ( ! empty($taxonomy)) {
                if (is_int($parent)) {
                    $query = $this->termRepository->getByNameOrSlugWithTaxonomy($term, $taxonomy, $parent);
                } else {
                    $query = $this->termRepository->getByNameOrSlugWithTaxonomy($term, $taxonomy);
                }
            } else {
                $query = $this->termRepository->getByNameOrSlug($term);
            }
        }

        if ($query) {
            Cache::tags('taxonomies')->forever($cacheKey, $query);

            return $query;
        }

        return false;

    }
954276
public function removeTerm($term_name, $taxonomy = '')
    {
        if (! $term = $this->getTerm($term_name, $taxonomy))
            return null;

        if ($taxonomy) {
            $taxonomy = $this->taxonomies->where('taxonomy', $taxonomy)->where('term_id', $term->id)->first();
        } else {
            $taxonomy = $this->taxonomies->where('term_id', $term->id)->first();
        }

        return $this->taxed()->where('taxonomy_id', $taxonomy->id)->delete();
    }
755723
function get_terms( $value, $taxonomy = 'category' ) {
		
		// load terms in 1 query to save multiple DB calls from following code
		if( count($value) > 1 ) {
			
			$terms = get_terms($taxonomy, array(
				'hide_empty'	=> false,
				'include'		=> $value,
			));
			
		}
		
		
		// update value to include $post
		foreach( array_keys($value) as $i ) {
			
			$value[ $i ] = get_term( $value[ $i ], $taxonomy );
			
		}
		
		
		// filter out null values
		$value = array_filter($value);
		
		
		// return
		return $value;
	}
1157386
public function getTerm($term_id, $from_cache = true)
    {
        if ($from_cache && array_key_exists($term_id, $this->terms)) {
            return $this->terms[$term_id];
        }

        $data = $this->termRepository->getTerm($term_id);
        $this->terms[$term_id] = $data;

        return $data;
    }
241846
def get_term(self,term_id):
        
        if term_id in self.idx:
            return Cterm(self.idx[term_id],self.type)
        else:
            return None
1161752
public function col_taxonomy( string $taxonomy, array $args ) {

		global $post;

		$terms = get_the_terms( $post, $taxonomy );
		$tax   = get_taxonomy( $taxonomy );

		if ( is_wp_error( $terms ) ) {
			echo esc_html( $terms->get_error_message() );
			return;
		}

		if ( empty( $terms ) ) {
			printf(
				'<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">%s</span>',
				esc_html( $tax->labels->no_terms )
			);
			return;
		}

		$out = [];

		foreach ( $terms as $term ) {

			if ( $args['link'] ) {

				switch ( $args['link'] ) {
					case 'view':
						if ( $tax->public ) {
							// https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1096
							// @codingStandardsIgnoreStart
							$out[] = sprintf(
								'<a href="%1$s">%2$s</a>',
								esc_url( get_term_link( $term ) ),
								esc_html( $term->name )
							);
							// @codingStandardsIgnoreEnd
						} else {
							$out[] = esc_html( $term->name );
						}
						break;
					case 'edit':
						if ( current_user_can( $tax->cap->edit_terms ) ) {
							$out[] = sprintf(
								'<a href="%1$s">%2$s</a>',
								esc_url( get_edit_term_link( $term, $taxonomy, $post->post_type ) ),
								esc_html( $term->name )
							);
						} else {
							$out[] = esc_html( $term->name );
						}
						break;
					case 'list':
						$link = add_query_arg( [
							'post_type' => $post->post_type,
							$taxonomy   => $term->slug,
						], admin_url( 'edit.php' ) );
						$out[] = sprintf(
							'<a href="%1$s">%2$s</a>',
							esc_url( $link ),
							esc_html( $term->name )
						);
						break;
				}
			} else {

				$out[] = esc_html( $term->name );

			}
		}

		echo implode( ', ', $out ); // WPCS: XSS ok.

	}
673136
protected function getTerm($taxonomySlug, $termSlug)
    {
        $taxonomy = $this->taxonomyRepository->findOneBy(['uri' => $taxonomySlug]);

        return $this->termRepository->findOneBy(
            [
                'taxonomy' => $taxonomy,
                'slug'     => $termSlug,
            ]
        );
    }
801964
public function getTaxonomyItemKeys($taxonomy)
    {
        return isset($this->taxonomy_map[$taxonomy]) ? array_keys($this->taxonomy_map[$taxonomy]) : [];
    }
38520
public function getTermsFor($taxonomy)
    {
        if (!($taxonomy instanceof Taxonomy)) {
            $taxonomy = $this->taxonomyFactory->create($taxonomy);
        }

        return $taxonomy->getTermsForPost($this);
    }
215807
public function getTerms($taxonomy)
    {
        // If terms isn't set
        if (!$this->terms) {
            // Retrieve the transient value
            $transientKey = sprintf('WPMVC\Models\Post::getTerms(%s)', $this->id(), $taxonomy);
            $terms = WP::getTransient($transientKey);
            // If the terms isn't found in the cache
            if (!$terms) {
                // Query for the terms
                $args = array(
                    'orderby' => 'name',
                    'order' => 'ASC'
                );
                // Retrieve and set the terms
                $terms = wp_get_post_terms($this->id(), $taxonomy, $args);
                // Store into the cache
                WP::setTransient($transientKey, $terms, static::$transientTimeout);
            }
            // Set the terms
            $this->terms[$taxonomy] = $terms;
        }
        return $this->terms[$taxonomy];
    }