-
Notifications
You must be signed in to change notification settings - Fork 122
How to query ACF Field of the "Group" type? #102
Comments
Hey Jason, I'm in the process of passing data from an existing WordPress installation to Gridsome and have had a bit of trouble exposing the Field Group to the WPGraphQL Schema. If I declare the Post Type value along with an additional condition (in my case Page Template) under Location the Field Group isn't exposed in the schema. I've tested it with just setting post_type => page without any other conditions and then the data is exposed properly. Seems like a bug as I don't want to show it on any page unless the correct template is selected. Any work around that I could add to my I am loving this plugin! Please keep up the hard work for a 1.0.0 release 🙌 |
Hello @Technicode this is a known "issue" with ACF location rules please reference this post for more information #135 . If you are looking for a quick workaround refer to this post #134 . I am using this particular workaround at the moment for a page builder feature i'm implementing. Be advised that the latest ACF Pro update 5.9.0 caused this work around to fail for me so I reverted ACF Pro back to 5.8.9 |
I havn't tried with ACT Pro 5.8.9 but from my understanding there shouldn't be any reason for the work around to break, unless wp-graphql-acf has generally broken because of the changes made to ACT Pro. Just tested that workaround on 5.9.1 and seems to be working fine, if you do still have an error/issue please post it in that other thread and I will take a look when i have time |
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 agraphql_field_name
.For example, I created a Field Group called "Group Test" and I registered a "Group" field (also named "Group Test"):
And I made sure to set the group to
show_in_graphql => true
and I provided the field namegroupTest
.Since the group is assigned to the
post_type => post
location, thegroupTest
field will now be available in the Schema on thePost
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.
I can now query for that "text" field on the "group" field like so:
The text was updated successfully, but these errors were encountered: