wp graphql add filter acf

Solutions on MaxInterview for wp graphql add filter acf by the best coders in the world

showing results for - "wp graphql add filter acf"
Lilita
06 Jun 2017
1add_filter('graphql_post_object_connection_query_args', function ($query_args, $source, $args, $context, $info) {
2
3    $post_object_id = $args['where']['postObjectId'];
4
5    if (isset($post_object_id)) {
6        $query_args['meta_query'] = [
7            [
8                'key' => 'myCustomField',
9                'value' => $post_object_id,
10                'compare' => '='
11            ]
12        ];
13    }
14
15    return $query_args;
16}, 10, 5);