Skip to content

[codex] Allow guideline type slugs in REST API - #79087

Draft
artpi wants to merge 1 commit into
WordPress:trunkfrom
artpi:codex/guideline-type-slugs
Draft

[codex] Allow guideline type slugs in REST API#79087
artpi wants to merge 1 commit into
WordPress:trunkfrom
artpi:codex/guideline-type-slugs

Conversation

@artpi

@artpi artpi commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

What?

Allows the /wp/v2/guidelines CPT REST controller to accept wp_guideline_type slugs wherever term IDs were previously required.

Why?

Clients currently need to discover term IDs before creating, updating, or filtering guidelines by type. Slugs are the public shape exposed by wp_guideline_types(), so accepting them makes agent and API flows simpler.

How?

  • Widens guideline type REST schemas for create/update and collection filters to accept integer IDs or strings.
  • Resolves existing slugs to term IDs and creates registered guideline type terms on write when needed.
  • Keeps permission checks aligned with assign/create term caps before core handles taxonomy assignment.
  • Normalizes collection include/exclude filters to term IDs without creating terms on read.

Testing

  • vendor/bin/phpcs lib/experimental/guidelines/class-gutenberg-guidelines-rest-controller.php phpunit/experimental/guidelines/class-gutenberg-standard-guidelines-rest-controller-test.php
  • npm run wp-env-test start -- --auto-port
  • npm run test:unit:php:base -- --group guidelines

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant