Get the terms related to a given taxonomy.

@param  string  $taxonomy
@return mixed
438378
public function getTerms($taxonomy = '')
    {
        if ($taxonomy) {
            $term_ids = $this->taxonomies->where('taxonomy', $taxonomy)->pluck('term_id');
        } else {
            $term_ids = $this->getTaxonomies('term_id');
        }

        return Term::whereIn('id', $term_ids)->get();
    }
970297
private function getCategoryCollection()
    {
        $categoryCollection = null;

        $suggestedTerms = $this->getSuggestedTerms();
        $terms          = [$this->queryFactory->get()->getQueryText()];

        if (!empty($suggestedTerms)) {
            $terms = array_merge($terms, $suggestedTerms);
        }

        $categoryCollection = $this->categoryCollectionFactory->create();
        $categoryCollection->addAttributeToSelect("is_active");
        $categoryCollection->setSearchQuery($terms);
        $categoryCollection->setPageSize($this->getResultsPageSize());

        return $categoryCollection;
    }
731396
public static function getOneByTerm($taxonomy, $terms, $field = 'slug', $args = array(), $load_terms = true)
    {
        $args['numberposts'] = 1;
        $result = static::getByTerm($taxonomy, $terms, $field, $args, $load_terms);
        return (count($result)) ? current($result) : null;
    }
526835
public static function query($terms)
    {
        return 'query='.urlencode(json_encode(array_map(function ($input, $field) {
            return [$field, '=', $input];
        }, $terms, array_keys($terms))));
    }
1088699
public function getFirst($termType) {
        foreach ($this->terms as $term) {
            if ((string)$term->getTermType() === $termType) {
                return $term;
            }
        }
        return null;
    }
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];
    }
235764
public function getValue()
    {
        $terms = $this->base['value'];

        if (is_array($terms)) {
            $ret = array();

            foreach ($terms as $t) {
                $ret[] = $this->termFactory->create($t, $this->taxonomy());
            }

            return $ret;
        } elseif (is_object($terms)) {
            return $this->termFactory->create($terms, $this->taxonomy());
        } else {
            if ($this->base['multiple'] || $this->base['field_type'] === 'multi_select' || $this->base['field_type'] === 'checkbox') {
                return array();
            } else {
                return null;
            }
        }
    }
573328
public function scopeWithTerms($query, $terms, $taxonomy)
    {
        $terms = TaxableUtils::makeTermsArray($terms);

        foreach ($terms as $term)
            $this->scopeWithTerm($query, $term, $taxonomy);

        return $query;
    }
905913
private function getSuggestedTerms()
    {
        $terms = array_map(
            function (\Magento\Search\Model\Autocomplete\Item $termItem) {
                return $termItem->getTitle();
            },
            $this->termDataProvider->getItems()
        );

        return $terms;
    }
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();
    }
384879
public function termGet(int $term_id)
    {
        $value = get_term_meta($term_id, $this->getName(), true);

        if (! empty($value)) {
            $this->setValue($value);
        }
    }
171137
public function get_terms( $taxonomy = '', $args = array() ) {
		if ( isset( $this->{$taxonomy} ) && empty( $args ) ) {
			return $this->{$taxonomy};
		} else {
			$name = $taxonomy . '_' . md5( json_encode( $args ) );
			if ( isset( $this->{$name} ) ) {
				return $this->{$name};
			}
			$data          = \wp_get_post_terms( $this->id(), $taxonomy, $args );
			$this->{$name} = $data;
			return $data;
		}
	}
741186
public function getByTaxonomy($taxonomy)
    {
        if (!($taxonomy instanceof Taxonomy)) {
            $taxonomy = $this->taxonomyFactory->create($taxonomy);
        }

        return $this->convertTermsArray(get_terms($taxonomy->getName(), array(
            'hide_empty' => false
        )), $taxonomy);
    }
1166658
function getTaxonomy($taxonomy)
    {
        $params = array(1, $this->username, $this->password, $taxonomy);

        return $this->sendRequest('wp.getTaxonomy', $params);
    }
1060810
public function update(Term $term)
    {
        return wp_update_term($term->id, $this->getSlug(), (array) $term->getAdaptee());
    }
606494
public function term_link( $termlink, $term, $taxonomy ) {
		/**
		 * WP_Rewrite.
		 *
		 * @var WP_Rewrite $wp_rewrite
		 */
		global $wp_rewrite;

		if ( ! $wp_rewrite->permalink_structure ) {
			return $termlink;
		}

		if ( CPTP_Util::get_no_taxonomy_structure() ) {
			return $termlink;
		}

		$taxonomy = get_taxonomy( $taxonomy );

		if ( empty( $taxonomy ) ) {
			return $termlink;
		}

		if ( $taxonomy->_builtin ) {
			return $termlink;
		}

		if ( ! $taxonomy->public ) {
			return $termlink;
		}

		$wp_home = rtrim( home_url(), '/' );

		if ( in_array( get_post_type(), $taxonomy->object_type, true ) ) {
			$post_type = get_post_type();
		} else {
			$post_type = $taxonomy->object_type[0];
		}

		$front         = substr( $wp_rewrite->front, 1 );
		$termlink      = str_replace( $front, '', $termlink );// remove front.

		$post_type_obj = get_post_type_object( $post_type );

		if ( empty( $post_type_obj ) ) {
			return $termlink;
		}

		$slug          = $post_type_obj->rewrite['slug'];
		$with_front    = $post_type_obj->rewrite['with_front'];

		if ( $with_front ) {
			$slug = $front . $slug;
		}

		if ( ! empty( $slug ) ) {
			$termlink = str_replace( $wp_home, $wp_home . '/' . $slug, $termlink );
		}

		if ( ! $taxonomy->rewrite['hierarchical'] ) {
			$termlink = str_replace( $term->slug . '/', CPTP_Util::get_taxonomy_parents_slug( $term->term_id, $taxonomy->name, '/', true ), $termlink );
		}

		return $termlink;
	}
252125
public function getTermsByType($type)
    {
        $terms = new ArrayCollection();
        $taxonomies = $this->getTaxonomiesByType($type);

        /* @var TermTaxonomy $taxonomy */
        if ($taxonomies !== null) {
            foreach ($taxonomies as $taxonomy) {
                $terms[] = $taxonomy->getTerm();
            }
        }

        return ($terms->count() == 0) ? null : $terms;
    }