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
idintTerm ID
namestringTerm name
slugstringTerm slug
descriptionstringTerm description (filtered, ready to render)
countintPost count
linkstringTerm archive URL
pathstringTerm archive path
edit_linkstring | nullAdmin edit URL (null when not authorized)
taxonomystringTaxonomy slug (e.g. 'category')
childrenarrayChild terms
postsquery, post_typeiterablePosts in this term
can_editboolCurrent 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 }}