Skip to content
This repository was archived by the owner on Jul 23, 2024. It is now read-only.
This repository was archived by the owner on Jul 23, 2024. It is now read-only.

How to query ACF Field of the "Group" type? #102

@jasonbahl

Description

@jasonbahl

Originally asked by @amreshabux on the main WPGraphQL repo: wp-graphql/wp-graphql#1079

Hey!

Are you using the WPGraphQL for ACF plugin?

If so, make sure to set the field group to show_in_graphql => true and provide a graphql_field_name.

For example, I created a Field Group called "Group Test" and I registered a "Group" field (also named "Group Test"):

Screen Shot 2019-12-13 at 9 52 20 AM

And I made sure to set the group to show_in_graphql => true and I provided the field name groupTest.

Screen Shot 2019-12-13 at 9 52 10 AM

Since the group is assigned to the post_type => post location, the groupTest field will now be available in the Schema on the Post Type.

I have a Group field registered, also named Group Test and in that Group field I added a text field, cleverly named "text".

I created a Post and saved a value within the "text" field.

Screen Shot 2019-12-13 at 9 52 36 AM

I can now query for that "text" field on the "group" field like so:

Screen Shot 2019-12-13 at 9 53 14 AM

Metadata

Metadata

Assignees

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