query custom post types by custom taxonomy #2289
Replies: 3 comments 3 replies
-
I wonder if you found any good solution to this problem..? I tried doing a similar query to find a custom post that matches the selected custom taxonomy.. no luck so far.. |
Beta Was this translation helpful? Give feedback.
-
https://github.com/wp-graphql/wp-graphql-tax-query query Products($category: [String], $operator: TaxQueryOperator = IN) {
products(
where: {
orderby: { field: DATE, order: ASC }
taxQuery: { taxArray: { taxonomy: PRODUCTCATEGORY, field: SLUG, operator: $operator, terms: $category } }
}
) {
edges {
node {
id
uri
title
date
categories: productCategories {
nodes {
id
name
}
}
featuredImage {
node {
id
}
}
}
}
}
} If category is empty (similar to |
Beta Was this translation helpful? Give feedback.
-
Update: It's now a native feature of Elementor, since version 3.21 |
Beta Was this translation helpful? Give feedback.
-
I have creted a custom post type with two custom taxonomies, and had them exposed to graphql.
They show correctly on the main tree, i can query the custom post type, the custom taxonomies and the custom post type contains the associated custom taxonomy.
But it looks i am missing a way to query the custom post type using the custom taxonomy, in the "where" possibilities there are not the custom taxonomy (as there are categories and tags in post)
Is there a way to add this way to filter?
i know i can query the custom taxonomy and show the associated custom post, but i wish i could keep the query 'straight' as i do for normal posts
Thank you
Beta Was this translation helpful? Give feedback.
All reactions