-
Notifications
You must be signed in to change notification settings - Fork 121
ACF Doesn't appear in schema when AND operator is used in Location #206
Comments
I have the same issue. Having to apply every single field to all pages makes the admin UI very messy. Is there any known solution or fix/hack for this? This is holding my current project back, and I can imagine this is something almost every user of this plugin will bump in to at some point. Thank you! 🙂 |
same here, we need to apply fields based on post type and category |
Actually its nothing to do with the 'And', the code has a flaw as it uses the underlying acf api calls, internally these rely on the current screen which is obviously inappropriate, the post type is the only rule you can rely on (which makes sense) except that any other rules fail which causes the acf_filter_field_groups fn to wipe out the field group (all rules must match). @jasonbahl I have re-coded 'add_acf_fields_to_post_object_types()' in class-config.php with a potential fix if you are interested. :-) |
Thank you...your class-config file fixed the issue for me! 🥇 |
Will there be an update to this any time soon? Are you open for PRs? I need to update a site to Gatsby v3 but currently can't due to this issue. Thanks! |
This is addressed by #250. With Release/v0.5.0, the field group rules are more broadly supported, and there's a new UI that allows you to override the location rules if the auto-mapping doesn't quite do what you need. For this specific rule, the auto-mapping of Location Rules to GraphQL Types is difficult to translate. The |
I've encountered a bug while trying to switch over from the REST API to the GraphQL one. We have a few Advanced Custom Fields that have more than 1 condition on them. I've noticed adding the AND operator in the location part of the Field Group causes it to no longer render in the schema.
Repro steps:
acf
Now go back to your acf field and add an AND to your location. For example:
![image](https://user-images.githubusercontent.com/10520771/104679569-cf725780-56a2-11eb-9219-d5b372c4af8c.png)
AND page type is equal to front page
** Note it could be any AND operator, I've tried many
Go back to graphiQL and notice the schema no longer has the acf field you've made. If you try to run the query you get an error (as expected the schema doesn't exist)
![image](https://user-images.githubusercontent.com/10520771/104679743-35f77580-56a3-11eb-951f-da45d27507e9.png)
Notes
I do have a Front page set in my application
![image](https://user-images.githubusercontent.com/10520771/104679524-bbc6f100-56a2-11eb-8976-4fa34e9f53ee.png)
Posts seem to be fine with the AND operator, it just seems to be pages for me.
Or operator seems to work fine for pages
Versions
WordPress:
v5.6
Advanced Custom Fields:
v5.9.4
WP GraphQL:
v1.1.2
WPGraphQL for Advanced Custom Fields:
v0.3.4
May be related to:
#76
The text was updated successfully, but these errors were encountered: