Terms Query

In this article


An advanced block that allows displaying taxonomy terms based on different query parameters and visual configurations.

  • Name: core/terms-query
  • Category: theme
  • API Version: 3
  • Block Type: Static (saved in post content)
  • Keywords: terms, taxonomy, categories, tags, list

Attributes

Defined via the attributes property in block.json.

Attribute Type Default Description
termQuery object {"perPage":10,"taxonomy":"category","order":"asc","orderBy":"name","include":[],"hideEmpty":true,"showNested":false,"inherit":false}
tagName string "div"

Supports

Defined via the supports property in block.json.

Context

Defined via the usesContext and providesContext properties in block.json.

Uses context:

  • templateSlug

Provides context:

  • termQuery attribute termQuery

Block Markup

This is a static block. The markup is saved directly in the post content.

<!-- wp:terms-query -->
<div class="wp-block-terms-query"></div>
<!-- /wp:terms-query -->

Source