Skip to main content

Term

Access taxonomy term data. Available on term archive pages and inside term Loop blocks (via the loop data alias).

All Fields​

FieldArgumentsReturnsDescription
id—intTerm ID
name—stringTerm name
slug—stringTerm slug
description—stringTerm description (filtered, ready to render)
count—intPost count
link—stringTerm archive URL
path—stringTerm archive path
edit_link—string | nullAdmin edit URL (null when not authorized)
taxonomy—stringTaxonomy slug (e.g. 'category')
children—arrayChild terms
postsquery, post_typeiterablePosts in this term
can_edit—boolCurrent user can edit
metafield_namemixedTerm meta value
raw_metafield_namemixedUnescaped meta value
has_fieldfield_nameboolCheck if field exists

Raw Database Fields​

Direct read access to the underlying WP_Term columns:

FieldReturnsDescription
IDintTerm ID (alias of id)
term_idintTerm ID
term_taxonomy_idintTerm taxonomy ID
term_groupintTerm group
parentintParent term ID, 0 if no parent

Taxonomy​

term.taxonomy returns the taxonomy slug as a string. To access the taxonomy object (for the human-readable label, hierarchy info, etc.) use the get_taxonomy() function:

{{ term.taxonomy }}                              <!-- 'category' -->
{{ get_taxonomy(term.taxonomy).label }} <!-- 'Categories' -->
{{ get_taxonomy(term.taxonomy).labels.singular_name }}

Hierarchy​

term.parent returns the parent term ID (or 0 if there is no parent). Use get_term() to chain into the parent term object:

{{ term.parent }}                                <!-- e.g. 5, or 0 if no parent -->
{{ get_term(term.parent).name }} <!-- Parent term name -->
{{ get_term(term.parent).link }}
{{ term.children }}

Posts​

term.posts returns an iterable collection of posts belonging to this term. It supports length and count, and accepts an optional query (limit, args) plus a post type override as a 2nd argument:

{{ term.posts }}                                          {# All posts #}
{{ term.posts(5) }} {# Limit to 5 #}
{{ term.posts({orderby: 'title'}) }} {# Custom query #}
{{ term.posts({posts_per_page: 5}, 'product') }} {# Override post type #}
{{ term.posts.length }} {# How many posts in the result #}

Permissions​

{{ term.can_edit }}

Custom Fields (Meta)​

{{ term.meta('icon') }}
{{ term.meta('color') }}
{{ term.meta('featured_image') }}
Plugin integration

meta('key') integrates with ACF, MetaBox, JetEngine, and Pods. Private meta keys (starting with _) are blocked for security.

Common Patterns​

Display term with post count​

{{ term.name }} ({{ term.count }})

Build breadcrumb with parent​

{% if term.parent %}{{ get_term(term.parent).name }} / {% endif %}{{ term.name }}
<a href="{{ term.link }}">{{ term.name }}</a>

Show taxonomy label​

{{ get_taxonomy(term.taxonomy).label }}: {{ term.name }}