This repository has been archived by the owner on Jul 23, 2024. It is now read-only.
Fix: relationship field should use graphql_acf_post_object_source filter #297
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SUMMARY
Fixes #155 and #272 when used in conjunction with PR on woographql: wp-graphql/wp-graphql-woocommerce#568
EXPLANATION
The
relationship
field in class config does not callgraphql_acf_post_object_source
like thepost_object
field does. By offloading the logic to wp-graphql-woocommerce, we can allow the filter to process additional post object types such as Products.NOTES
NOTE: This is only a temporary fix as significant schema changes are expected in wp-graphql-acf 0.6.0.
NOTE: This does NOT resolve another edge case where an error will be thrown when no post type filters are set on the custom field. This is because when no filter is set, the $acf_field['post_type'] is set to an empty string, causing the type of the
post_object
orrelationship
to be defaulted toPostObjectUnion
type.