Atlas Content Modeler Taxonomies - Query

Note: These tutorials assume that you have already installed the plugin.

Learn how to query models by taxonomy using WPGraphQL.


Please download and install WPGraphQL following these instructions: WPGraphQL Installation - Quick Start.

Please download, install, and activate WPGraphQL Tax Query by uploading the plugin zip file in the WordPress admin.

Once you have successfully installed and activated these plugins, you may continue with the steps below for Querying Taxonomies.


You can find detailed steps in the basic usage of WPGraphQL here: WPGraphQL Quick Start

The steps below are more specific on how to query content models by taxonomy. This assumes you have already Created a Model, and Created a Taxonomy for that model. The query below is in GraphiQL in the WordPress plugin WPGraphQL.


This example queries a Model called Employees. Employees uses the LOCATION Taxonomy. In this case, we are querying the term dallas and the taxonomy LOCATION inside of the taxQuery: object.

{
employees(first: 10,
where: {
taxQuery: {
taxArray: [
{
terms: ["dallas"],
taxonomy: LOCATION,
operator: IN,
field: SLUG
}
]
}
}
){
nodes {
name
}
}
}

This example queries a Model called Companies. Companies uses the REGION Taxonomy. In this case, we are querying the term east coast and the taxonomy REGION inside of the taxQuery: object.

{
companies(first: 2,
where: {
taxQuery: {
taxArray: [
{
terms: ["east coast"],
taxonomy: REGION,
operator: IN,
field: SLUG
}
]
}
}
){
nodes {
name
}
}
}