WPGraphQL Tax Query
This FREE plugin filters the connections for Posts and Post Types to allow for advanced querying by taxonomy filters.
A feature like this will be in core WPGraphQL soon, but for now you can use the plugin.
Official Plugin
View Plugin on GithubWPGraphQL Tax Query
This plugin adds TaxQuery support to the WP GraphQL Plugin for postObject query args (WPQuery).
Pre-req's
Using this plugin requires having the WPGraphQL plugin installed and activated. (version 0.0.15 or newer)
Activating / Using
Activate the plugin like you would any other WordPress plugin.
Once the plugin is active, the taxQuery
argument will be available to any post object connectionQuery
(posts, pages, custom post types, etc).
Example Query
Below is an example Query using the taxQuery input on a posts
query. (Go ahead and check things out in
GraphiQL)
This will find posts
that are in the category "graphql" OR tagged with "wordpress".
The same query in PHP using WP_Query would look like: