Skip to content

Term Query

The Term Query node fetches taxonomy terms from WordPress. Use it to load categories, tags, or custom taxonomy terms registered by WP-Nexus or other plugins.

Configuration

PropertyTypeDefaultDescription
taxonomystringcategoryThe taxonomy slug (e.g., category, post_tag, or a WP-Nexus taxonomy like nxs_mytax).
hideEmptybooleanfalseWhen true, only returns terms that have at least one associated post.
orderBystringnameSort field: name, slug, count, id, term_id, description.
orderstringASCSort direction: ASC or DESC.
conditionsarray[]Array of condition objects. Each has field, op, value, and optionally value2 (for BETWEEN). See Table Query: Conditions for full details.
conditionLogicstringANDHow multiple conditions combine: AND or OR.
limitnumber100Maximum terms to return (capped at 1,000).
offsetnumber0Number of terms to skip.

Input

This is a source node -- it has no input port.

Output

Returns an array of term objects with core fields and all term meta flattened:

json
[
  {
    "term_id": 5,
    "name": "JavaScript",
    "slug": "javascript",
    "description": "Posts about JavaScript programming",
    "count": 12,
    "icon_url": "https://example.com/js-icon.png"
  }
]

How It Works

The node calls WordPress get_terms() with the configured arguments. For each term, it:

  1. Extracts core fields: term_id, name, slug, description, count.
  2. Fetches all term meta via get_term_meta() and merges it into the row.

TIP

This node supports the enhanced conditions system with multiple conditions, AND/OR logic, and operators like BETWEEN, IN, NOT IN, IS NULL, and IS NOT NULL. See the Table Query: Conditions documentation for full details. Legacy single-condition properties (whereField, whereOp, whereValue) still work for backward compatibility.

WHERE Filtering

  • name with LIKE: Uses the name__like parameter for partial name matching.
  • slug with =: Uses the slug parameter for exact slug matching.
  • Other core fields (description, count): Filtered in PHP after the query.
  • Meta fields: Uses meta_query for direct database filtering.

Example Use Cases

List all categories

taxonomy: "category"
orderBy: "name"
order: "ASC"

Load non-empty tags sorted by popularity

taxonomy: "post_tag"
hideEmpty: true
orderBy: "count"
order: "DESC"
limit: 20

Search terms by name

taxonomy: "category"
whereField: "name"
whereOp: "LIKE"
whereValue: "tech"

Filter by custom term meta

taxonomy: "nxs_locations"
whereField: "region"
whereOp: "="
whereValue: "europe"

TIP

Term queries are useful for building category navigation, tag clouds, and filter dropdowns. Combine with a Post Query node filtered by term to create category-based listings.