Guide

Block Library REST API

The plugin registers three read-only routes in the prc-api/v3 namespace. Requests use the WordPress REST base path: /wp-json/prc-api/v3/.

Route index

MethodRouteAccessPurpose
GET/blocks/taxonomy-searchPublicSearch taxonomy terms
GET/blocks/taxonomy-index-az-listRequires the read capabilityList terms whose names start with a letter
GET/render-to-regionsPublicList configured render regions for a post or template

Search taxonomy terms

GET /wp-json/prc-api/v3/blocks/taxonomy-search

ParameterTypeRequiredDefaultDescription
taxonomystringNoTaxonomy slug passed to get_terms()
searchstringNoTerm-name search text
parent_term_idstringNoLimits results to children of this term ID
per_pageintegerNo25Positive result limit

The route returns WordPress term objects. Each result also includes link and a plain-text description. Results are cached for one day by query arguments.

The route is public. Callers must use only taxonomies and result data that are safe to expose.

Source: src/taxonomy-search/class-taxonomy-search.php

List terms by letter

GET /wp-json/prc-api/v3/blocks/taxonomy-index-az-list

ParameterTypeRequiredDescription
taxonomystringNoComma-separated taxonomy slugs
letterstringNoPrefix used to filter term names

The callback returns matching WP_Term objects. It returns false when the taxonomy or letter is empty, or when no terms match. The route requires a user who has the read capability.

The implementation first queries with name__like, then removes terms whose names do not start with the requested letter. Results use the prc-block-library object-cache group.

Source: src/taxonomy-index-az-list/class-taxonomy-index-az-list.php

List render regions

GET /wp-json/prc-api/v3/render-to-regions

ParameterTypeRequiredDescription
postintegerNoResolve regions from the post's _wp_template meta; falls back to single
templatestringNoResolve regions for this template name

When both parameters are present, post takes precedence. The route returns an array of region-name strings. It returns null when neither parameter is present.

The route is public. Region configuration comes from the plugin's prc_block__render_to_regions option.

Source: src/render-to-region/class-render-to-region.php

Was this helpful?