Taxonomy Repository

To work with the with Taxonomy Repository, use the following Facade:

use Statamic\Facades\Taxonomy;


Methods Description
all() Get all Taxonomies
find($id) Get Taxonomy by id
findByHandle($handle) Get Taxonomy by handle
findByUri($mount) Get Taxonomy by uri
handleExists($handle) Check to see if Taxonomy exists
handles() Get all Taxonomy handles
queryTerms() Query Builder for Terms
make() Makes a new Taxonomy instance
Hot Tip!

The id is the same as handle while using the default Stache driver.


While the Taxonomy Repository does not have a Query Builder, you can still query for Terms inside Taxonomies with the queryTerms method. This approach can be useful for retrieving Terms with an existing Taxonomy object.

$tags = Taxonomy::find('tags');


Start by making an instance of a taxonomy with the make method. You can pass the handle into it.

$taxonomy = Taxonomy::make('tags');

You may call additional methods on the taxonomy to customize it further.

->cascade($data) // an array
->defaultPublishState('published') // or 'draft'
->sites(['one', 'two']) // array of handles

Finally, save it.

HR: Section
Learn More!

There is more to learn more in these related articles:


HR: Section
Docs feedback

Submit improvements, related content, or suggestions through Github.

Betterify this page →