wp-graphql filter posts by meta key value code example
Example: wp graphql add filter acf
add_filter('graphql_post_object_connection_query_args', function ($query_args, $source, $args, $context, $info) {
$post_object_id = $args['where']['postObjectId'];
if (isset($post_object_id)) {
$query_args['meta_query'] = [
[
'key' => 'myCustomField',
'value' => $post_object_id,
'compare' => '='
]
];
}
return $query_args;
}, 10, 5);