Select Field

June 30, 2021 ยท View on GitHub

Select fields (when configured to not allow mutliple selections) are added to the WPGraphQL Schema as a field with the Type String.

Select fields, without multiple selections allowed, can be queried and a String will be returned.

Here, we have a Select field named select on the Post Edit screen within the "ACF Docs" Field Group, and "Choice 1" is selected.

Select field in the Edit Post screen

This field can be Queried in GraphQL like so:

{
  post(id: "acf-example-test", idType: URI) {
    acfDocs {
      select
    }
  }
}

and the results of the query would be:

{
  "data": {
    "post": {
      "acfDocs": {
        "select": "choice_1"
      }
    }
  }
}