Closed mathieuCatapulpe closed 11 months ago
@mathieuCatapulpe At this time WPGraphQL for ACF does not support filtering or sorting queries by ACF Fields. "Meta Queries" are often very expensive to execute, so we currently do not support filtering by ACF fields out of the box, but are exploring options for supporting it without the performance penalty.
You can add sorting by ACF Field values on your own by using underlying APIs such as register_graphql_field
.
There's an example of this here: https://www.wpgraphql.com/2020/04/14/query-posts-based-on-advanced-custom-field-values-by-registering-a-custom-where-argument
Hey, I would like to start by saying that this is not a bug but more of a question as to how can I achieve my request (if it is achievable at all), I hope this is the right place for this.
I have a custom post type named "events" with a repeater field "dates" inside this repeater there is a field "start_date"
As of right now my grapqhql request is quite simple, I fetch all my events, sort and filter them from my vuejs app using the start_date field, if there are multiple dates I duplicate the event and set the corresponding date, for instance if I have two events I will get something like :
Event 1 - 18/12/2023 Event 2 - 19/12/2023 Event 1 - 20/12/2023 (duplicate of Event 1 done in vuejs)
My main issue is that I have to do all this filtering and sorting in my frontend, which is not a problem when I have 5 events but becomes quite slow when I reach hundreds of them.
Is there a way to replicate this kind of results using wpgraphql in the backoffice ? I know we can use acf fields as filter and already done so for simple use cases scenarios with basic boolean or text fields for instance, but i can't find any ressource online about more complex filters like this one.