fix(terms): honour selected taxonomy on term generation - #227
Merged
Conversation
The Terms endpoint registered a singular 'taxonomy' arg with a hard-coded 'category' default, which WP REST injects into every request; the old translate block then copied that default over the admin form's plural 'taxonomies' value, so every term landed in 'category' regardless of the Tags/Categories selection. Prefer the plural 'taxonomies' value, accept the singular 'taxonomy' as an alias, normalise arrays to a comma-separated string, and drop the schema default. Mirrors the Posts #210 and Users #217 fixes. Fixes #218
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fixes #218
Reported on wp.org: https://wordpress.org/support/topic/tags-not-being-created/
Problem
Generating terms with Tags selected created Categories instead — every term landed in
categoryregardless of the selection.Root cause
Terms.phpregistered a singulartaxonomyarg with a hard-codeddefault => category. WP REST merges that default into every request, and the old translate block unconditionally copied it over the admin form's pluraltaxonomiesvalue:Same class of bug as the Posts
post_types(#210) and Usersrole(#217) regressions.Fix
Prefer the plural
taxonomiesvalue, accept the singulartaxonomyas a deprecated alias, normalise arrays to a comma-separated string, and drop thecategoryschema default.Tests
TermsEndpointTest: pluraltaxonomiesgenerates tags, plural wins over the singular alias, and a CSVtaxonomiesvalue samples across the requested taxonomies.Milestone: 0.9.2