Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/advice request: Make taxQuery argument available on post object when inside an acf relationship field. #22

Open
mjwlist opened this issue Nov 4, 2020 · 0 comments

Comments

@mjwlist
Copy link

mjwlist commented Nov 4, 2020

Hi I'm not really sure if this should be asked here or here https://github.com/wp-graphql/wp-graphql-acf/issues as this relates to both, or at least combining both.

I would like to know if it is possible to add the taxQuery to posts that are added within the acf relationship field so they can be queried in the same way as the post itself.

EG:
On posts or custom post types etc it is fantastic to query as follows:-

query{
posts(where: {taxQuery: {taxArray: {field: SLUG, operator: IN, taxonomy: SOME_CATEGORY, terms: "some-term"}}}) {
edges {
node {
id
}
}
}
}

What I need to achieve is to have the same taxArray filtering options available on posts added within an acf relationship field.

EG:
Take the following query on an acf relationship field:-

query{
someCustomPostType(where: {name: "some-name"}) {
nodes {
id
content_relations {
content {
... on Post {
id
}
... on CustomPost {
id
}
}
}
}
}

Is there any possibility of making the taxQuery available on the content node??
Something like the following:-

query{
someCustomPostType(where: {name: "some-name"}) {
nodes {
id
content_relations {
content(where: {taxQuery: {taxArray: {field: SLUG, operator: IN, taxonomy: SOME_CATEGORY, terms: "some-term"}}}) {
... on Post {
id
}
... on CustomPost {
id
}
}
}
}
}

You might wonder why not just query the two or more post types directly which of course would work just fine.
The single benefit of doing with the relationship field it to be able to set the order of the posts in the response. Thats it.

Any thoughts, ideas, advice greatly appreciated. This is something I really need to implement somehow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant