Skip to content

Fix ACF REST field registration for built-in tags#1008

Open
harugon wants to merge 2 commits intoAdvancedCustomFields:masterfrom
harugon:master
Open

Fix ACF REST field registration for built-in tags#1008
harugon wants to merge 2 commits intoAdvancedCustomFields:masterfrom
harugon:master

Conversation

@harugon
Copy link
Copy Markdown

@harugon harugon commented Mar 28, 2026

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:

  • Update register_field() to register built-in tag fields against the REST object type tag, matching WordPress core behavior.
  • In load_fields() and update_fields(), preserve the original taxonomy slug for ACF field-group matching when handling term objects.

This allows /wp/v2/tags/{id} to expose the acf field correctly while preserving existing ACF taxonomy-based field-group matching.

Related to #664.

harugon added 2 commits March 28, 2026 21:04
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
@harugon harugon requested a review from a team as a code owner March 28, 2026 12:54
Copilot AI review requested due to automatic review settings March 28, 2026 12:54
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_tag terms against the REST object type tag (so /wp/v2/tags/{id} includes acf).
  • 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.

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.

2 participants