wp-graphql / wp-graphql-tax-query

Adds `tax_query` support to postObject connection queries using WP_Query
46 stars 16 forks source link

Make a search in ACF custom field value #37

Open elron opened 1 year ago

elron commented 1 year ago

I want to perform a search query for a custom post type (poems, similar to posts), and search in the value of the field "text_to_index".

For example, a poem (post) could have "text_to_index" custom field, with this value: "Please feed the cats"

I want to be able to search "cats" and retrieve the relevant poem node.

{
  poems(where: {search: "cats"}) {
    nodes {
      id
      title
      content
    }
  }
}

Currently, the above query only searches in "title" and "content". I need it to search in the value of ACF custom field.

How do I do that?