Search posts by custom taxonomy or AFC taxonomy #2237
Answered
by
albertcito
albertcito
asked this question in
Q&A
-
I created a custom taxonomy for my posts like:
So, how can I create a query to get all {
posts(where: { taxonomyName: "Featured" }) {
edges {
node {
title
content
}
}
}
} |
Beta Was this translation helpful? Give feedback.
Answered by
albertcito
Mar 21, 2022
Replies: 1 comment 1 reply
-
I found the solution. Just use this plugin: I have a post_type called {
books(
where: {
taxQuery: {
taxArray: {
taxonomy: AUTHORTAG,
operator: AND,
terms: "john-doe",
field: SLUG
}
}
}
) {
nodes {
databaseId
title
authorTags {
nodes {
databaseId
slug
}
}
}
}
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
albertcito
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I found the solution. Just use this plugin:
https://github.com/wp-graphql/wp-graphql-tax-query
I have a post_type called
books
and a taxonomy callauthor
. This is the query in order to get all