Skip to content

Post Object field type isn't resolving correctly when "Return Format" is set to "Post Object" instead of ID #115

@jasonbahl

Description

@jasonbahl

Description

When the "Return Format" setting of the "post_object" ACF Field Type is set to "Post Object", the GraphQL Resolver doesn't resolve as expected.

Steps to reproduce

  1. Create an ACF Field Group that is set to "show_in_graphql"
  2. Add a field of the "repeater" field type, with a nested field of the "post_object" type
  3. Set the "Return Format" of the "post_object" field type to "Post Object"
  4. Edit a post that has the field group, and set a Post as the value of the post object field within the repeater
  5. Query for the repeater field and nested post object field in GraphQL

Expected

I expect to see a Connection that includes the Post(s) set as the value(s) of the post object field:

CleanShot 2023-11-06 at 14 18 36

Actual

A PHP error prevents the GraphQL response:

CleanShot 2023-11-06 at 14 22 58

PHP or JSON export of the ACF Field Group(s)

No response

Additional context

This appears to be related to /src/FieldType/PostObject.php:70

The same logic is found in the PageLink and Relationship fields.

WPGraphQL Version

1.18.0

WPGraphQL For ACF Version

v2.0.0-beta5.1.0

ACF (Advanced Custom Fields) Version. Free or Pro?

latest, PRO

WordPress Version

6.3

PHP Version

8.1

Additional enviornment details

No response

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have disabled ALL plugins except for WPGraphQL, WPGraphQL For ACF, ACF, etc.

  • Yes
  • My issue is with compatibility with a specific WordPress plugin, and I have listed all my installed plugins (and version info) above.

Metadata

Metadata

Assignees

Labels

type: bugIssue that causes incorrect or unexpected behavior

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions