Return a collection of post taxonomies terms

@param  string $taxonomy 'post_tag' is default
@return Collection
194289
public function terms($taxonomy = 'post_tag')
	{
		$postTerms = wp_get_post_terms($this->ID, $taxonomy);

		$cats = array();

		foreach ($postTerms as $c)
		{
			$c->permalink = get_term_link($c, $c->taxonomy);
			$cats[]       = $c;
		}

		return Collection::make($cats);
	}
200538
public function getPostsByTags($limit = 6, $tagIDs = [])
    {
        $tags = "tags";
        // Validate post type
        if(!$tagIDs) {
            $tagIDs = [];
            foreach ($this->$tags as $tag) {
                $tagIDs[] = $tag->tagID;
            }
        }

        if($tagIDs) {
            $postsObj = new Post();
            $postsObj->setTable($this->getTable());
            $posts = $postsObj
                ->select('postID', 'title', 'featuredImageID', 'slug')
                ->join($this->getTable().'_tags', $this->getTable().'_tags.postID', $this->getTable() . '.postID')
                ->with('featuredImage')
                ->published()
                ->whereIn('tagID', $tagIDs)
                ->where('postID', "!=", $this->postID)
                ->orderBy('published_at', 'DESC')
                ->limit($limit)
                ->get();

            return $posts;
        }else{
            return collect();
        }
    }
357564
public function terms($taxonomy = null, array $arguments = [])
    {
        if (isset($taxonomy)) {
            return $this->model->getTerms($this, $taxonomy, $arguments);
        }

        return $this->model->getAllTerms($this);
    }
302035
public function getTermsAttribute()
    {
        return $this->taxonomies->groupBy(function ($taxonomy) {
            return $taxonomy->taxonomy == 'post_tag' ? 'tag' : $taxonomy->taxonomy;
        })->map(function ($group) {
            return $group->mapWithKeys(function ($item) {
                return [$item->term->slug => $item->term->name];
            });
        })->toArray();
    }
1354287
protected function get_term_ids( $taxonomy ) {
		$terms = get_the_terms( $this->get_id(), $taxonomy );

		if ( false === $terms || is_wp_error( $terms ) ) {
			return [];
		}

		return wp_list_pluck( $terms, 'term_id' );
	}
986793
public function getTerms(Post $post, $taxonomy)
    {
        $model = App::make(TaxonomyModel::class);

        return $model->make($taxonomy)->postTerms($post);
    }
1224604
public function getKeywordsAttribute()
    {
        return collect($this->terms)->map(function ($taxonomy) {
            return collect($taxonomy)->values();
        })->collapse()->toArray();
    }
332835
public function getTaxonomiesByType($type)
    {
        $taxonomies = new ArrayCollection();

        /** @var TermRelationships $relationship */
        foreach ($this->getTermRelationships() as $relationship) {
            if ($type === $relationship->getTaxonomy()->getTaxonomy()) {
                $taxonomies[] = $relationship->getTaxonomy();
            }
        }

        return ($taxonomies->count() == 0) ? null : $taxonomies;
    }
1020884
public function getTerms($taxonomy = null)
    {
        if ($taxonomy) {
            return (array_key_exists($taxonomy, $this->_terms))
                ? $this->_terms[$taxonomy]
                : array();
        }

        return $this->_terms;
    }
420751
public function getAllTagsMap()
    {
        $tags = TaxonomyTerm::get()->filter(
            'Type.Name:ExactMatch',
            Config::inst()->get('DMSTaxonomyTypeExtension', 'default_record_name')
        );

        $map = array();
        foreach ($tags as $tag) {
            $nameParts = array($tag->Name);
            $currentTag = $tag;

            while ($currentTag->Parent() && $currentTag->Parent()->exists()) {
                array_unshift($nameParts, $currentTag->Parent()->Name);
                $currentTag = $currentTag->Parent();
            }

            $map[$tag->ID] = implode(' > ', $nameParts);
        }
        return $map;
    }
1230411
function getTerms($taxonomy, array $filter = array())
    {
        $params = array(1, $this->username, $this->password, $taxonomy, $filter);

        return $this->sendRequest('wp.getTerms', $params);
    }
1205161
public function UpdateTags()
    {
        $siteTree = DataObject::getSchema()->tableName(SiteTree::class);
        $taxonomy = DataObject::getSchema()->tableName(TaxonomyTerm::class);

        $tags = TaxonomyTerm::get()
            ->innerJoin('BasePage_Terms', sprintf('"%s"."ID"="BasePage_Terms"."TaxonomyTermID"', $taxonomy))
            ->innerJoin(
                $siteTree,
                sprintf(
                    '"%s"."ID" = "BasePage_Terms"."BasePageID" AND "%s"."ParentID" = \'%d\'',
                    $siteTree,
                    $siteTree,
                    $this->ID
                )
            )
            ->sort('Name');

        return $tags;
    }
1248149
protected function getTaxonomyByKey($key)
    {
        foreach ($this->registeredTaxonomies as $taxonomy) {
            /** @var Taxonomy $taxonomy */
            if ($taxonomy->getKey() === $key) {
                return $taxonomy;
            }
        }
    }
1227107
protected function get_taxonomies() {
        $taxonomies = explode(',', $this->raw_get('taxonomies'));

        // Indexing first level at 1.
        array_unshift($taxonomies, null);
        unset($taxonomies[0]);

        // Ensure that we do not return empty levels.
        foreach ($taxonomies as $i => $taxonomy) {
            if (empty($taxonomy)) {
                $taxonomies[$i] = self::TAXONOMY_COMPETENCY;
            }
        }

        return $taxonomies;
    }
280325
public function getTaxonomiesInfo()
    {
        $taxonomies = $this->getTaxonomies();
        if (!Arr::iterable($taxonomies)) {
            return array();
        }

        $out = array();
        foreach ($taxonomies as $k => $taxonomy) {
            $taxonomy = $this->getTaxonomy($k);
            $key = $this->getTaxonomyKey($k, $taxonomy);
            $out[] = array(
                'key'       => $key,
                'post_type' => $this->getPostType(),
                'config'    => $taxonomy
            );
        }
        return $out;
    }
1338365
public function get_items( $request ) {

		// Retrieve the list of registered collection query parameters.
		$registered = $this->get_collection_params();

		if ( isset( $registered['type'] ) && ! empty( $request['type'] ) ) {
			$taxonomies = get_object_taxonomies( $request['type'], 'objects' );
		} else {
			$taxonomies = get_taxonomies( '', 'objects' );
		}
		$data = array();
		foreach ( $taxonomies as $tax_type => $value ) {
			if ( empty( $value->show_in_rest ) || ( 'edit' === $request['context'] && ! current_user_can( $value->cap->manage_terms ) ) ) {
				continue;
			}
			$tax = $this->prepare_item_for_response( $value, $request );
			$tax = $this->prepare_response_for_collection( $tax );
			$data[ $tax_type ] = $tax;
		}

		if ( empty( $data ) ) {
			// Response should still be returned as a JSON object when it is empty.
			$data = (object) $data;
		}

		return rest_ensure_response( $data );
	}
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;
	}