Make WordPress Core

Opened 5 hours ago

Last modified 5 hours ago

#64608 new enhancement

Backport: Add Terms Query Pagination blocks

Reported by: jillro's profile jillro Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: trunk
Component: Editor Keywords: has-patch
Focuses: Cc:

Description

Introduce new blocks to enable pagination for terms queries, including "Previous", "Next", and "Page Numbers" links.

Change History (1)

This ticket was mentioned in PR #10872 on WordPress/wordpress-develop by @jillro.


5 hours ago
#1

Adds build_terms_query_vars_from_block() and terms_query_register_query_vars() to wp-includes/blocks.php to support pagination in the Terms Query block.

These helper functions are used by:

  • The updated Term Template block (which now supports paginated term results via the termspage query variable)
  • The new Terms Query Pagination blocks (core/terms-query-pagination, core/terms-query-pagination-next, core/terms-query-pagination-previous, core/terms-query-pagination-numbers)

build_terms_query_vars_from_block() extracts and normalizes query arguments from the block context, handling both inherited (taxonomy archive) and custom term queries. It follows the same pattern as the existing build_query_vars_from_query_block() and build_comment_query_vars_from_block().

terms_query_register_query_vars() registers termspage as a public query variable so it can be used for pagination URLs.

The block files themselves (block.json, index.php, CSS, JS) are synced automatically via the Gutenberg build process.

Note: See TracTickets for help on using tickets.