Skip to content

Latest commit

 

History

History
53 lines (41 loc) · 1.1 KB

taxonomy.md

File metadata and controls

53 lines (41 loc) · 1.1 KB

Taxonomy Field

The Taxonomy field is added to the GraphQL Schema as a List Of the Taxonomy Type.

For example, if the field is configured to the "Category" taxonomy, then the field in the Schema will be a List of the Category type.

Taxonomy field Taxonomy Config

Here, we have a Taxonomy field named taxonomy on the Post Edit screen within the "ACF Docs" Field Group, configured with the Category "Test Category".

Taxonomy field in the Edit Post screen

This field can be queried like so:

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

and the results of the query would be:

{
  "data": {
    "post": {
      "acfDocs": {
        "taxonomy": [
          {
            "__typename": "Category",
            "id": "Y2F0ZWdvcnk6Mg==",
            "name": "Test Category"
          }
        ]
      }
    }
  }
}

  • Previous Field: Tab
  • Next Field: Text