Skip to content

REST API: Prevent taxonomy REST bases from overwriting post item properties - #13013

Open
csergozoltan wants to merge 1 commit into
WordPress:trunkfrom
csergozoltan:65855-rest-taxonomy-property-collision
Open

REST API: Prevent taxonomy REST bases from overwriting post item properties#13013
csergozoltan wants to merge 1 commit into
WordPress:trunkfrom
csergozoltan:65855-rest-taxonomy-property-collision

Conversation

@csergozoltan

Copy link
Copy Markdown

Trac ticket: https://core.trac.wordpress.org/ticket/65855

This PR prevents taxonomies with conflicting REST bases from overwriting existing post item properties.

The existing _doing_it_wrong() warning added for #48401 is preserved, but conflicting taxonomies are excluded from the item-level REST taxonomy set so they no longer participate in:

  • item schema properties;
  • prepared item responses;
  • term assignment;
  • term assignment permission checks;
  • REST action links; and
  • schema links.

The conflict-free taxonomy list is initialized while building the item schema and reused by the relevant item-level paths. This avoids lazily calling get_item_schema() from the helper, which could introduce recursion in subclasses such as WP_REST_Menu_Items_Controller.

Collection-level taxonomy query behavior is intentionally unchanged.

Tests added for:

  • preserving the existing type schema property when a taxonomy name conflicts;
  • preserving the existing type response property;
  • the WP_REST_Menu_Items_Controller subclass schema path.

Testing:

  • npm run test:php -- --group 65855
    • OK (3 tests, 7 assertions)
  • npm run test:php -- --filter WP_Test_REST_Posts_Controller
    • OK (283 tests, 2637 assertions)
  • npm run test:php -- --filter Tests_REST_WpRestMenuItemsController
    • OK (41 tests, 441 assertions)
  • PHPCS passes for all four modified files.
  • git diff --check reports no whitespace errors.

@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props wteam.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@csergozoltan
csergozoltan force-pushed the 65855-rest-taxonomy-property-collision branch from a832668 to 124936d Compare August 12, 2026 10:20
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