Visitar URL original
When updating a post via the REST API, a validation error for a required field occurs on a field that should not be associated with the post. · Issue #1051 · AdvancedCustomFields/acf · GitHub
Skip to content

When updating a post via the REST API, a validation error for a required field occurs on a field that should not be associated with the post. #1051

Open

Description

@kimura-makoto

Describe the bug
When updating a post via the REST API, a validation error for a required field occurs on a field that should not be associated with the post.

To Reproduce
For the custom post type I created, I have configured rules on the "Edit Field Group" screen in the admin panel to change the added fields for each taxonomy as follows. All added fields are set as required.

Post Type A

  • Field 1 (Required) → Rule: Post Taxonomy is equal to Taxonomy α
  • Field 2 (Required) → Rule: Post Taxonomy is equal to Taxonomy β
  • Field 3 (Required) → Rule: Post Taxonomy is equal to Taxonomy γ

When I tried to update a post via the REST API in this state, a validation error occurred for Field 3 being required, even though the post belongs to Taxonomy α.

Expected behavior
Normally, I understand that the required validation should not be executed for fields that are not associated with the post.

Code
acf-export-2026-10-20.json

Version Information:

  • WordPress Version [7.0.2]
  • PHP Version [8.1.29]
  • ACF Version [ACF Free 6.8.10]
  • Browser [chrome 155.0.8059.84]

Additional context
After looking into the source code, I found a difference in how field_groups are retrieved within the get_schema function in class-acf-rest-api.php:

Version 6.8.10 uses the get_field_groups_by_object_type function.

Version 6.8.9 used get_field_groups_by_id when object_id was not present.
This change seems to be causing the issue.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions