Fix ACF REST field registration for built-in tags#1008
Open
harugon wants to merge 2 commits intoAdvancedCustomFields:masterfrom
Open
Fix ACF REST field registration for built-in tags#1008harugon wants to merge 2 commits intoAdvancedCustomFields:masterfrom
harugon wants to merge 2 commits intoAdvancedCustomFields:masterfrom
Conversation
WordPress uses "tag" as the additional REST fields object type for the
built-in "post_tag" taxonomy.
ACF was registering built-in tag fields against the taxonomy name
("post_tag"), so the "acf" field was never exposed on /wp/v2/tags
responses.
Register built-in tag fields against "tag" while preserving "post_tag"
for internal ACF field-group matching in REST callbacks.
…ation Fix ACF REST field registration for built-in tags
There was a problem hiding this comment.
Pull request overview
Fixes ACF REST field exposure for the built-in WordPress tag taxonomy by aligning ACF’s REST field registration with WordPress core’s REST “additional fields” object type handling for tags.
Changes:
- Register ACF REST fields for
post_tagterms against the REST object typetag(so/wp/v2/tags/{id}includesacf). - Preserve the original taxonomy slug (
post_tag) for term field-group matching when loading/updating fields.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Fix ACF REST field registration for built-in tags
This pull request fixes ACF fields assigned to the built-in WordPress tag taxonomy (
post_tag) not being exposed correctly in WordPress REST API responses.The issue was caused by a mismatch between the taxonomy slug used internally by ACF (
post_tag) and the REST additional fields object type used by WordPress core for built-in tags (tag).Changes in this patch:
register_field()to register built-in tag fields against the REST object typetag, matching WordPress core behavior.load_fields()andupdate_fields(), preserve the original taxonomy slug for ACF field-group matching when handling term objects.This allows
/wp/v2/tags/{id}to expose theacffield correctly while preserving existing ACF taxonomy-based field-group matching.Related to #664.