You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to figure out how to order the related posts from a field group, using 2.0.0. In this case specifically I have a custom Author post type ("post_author" is the registered post type), which then has a field group (registered graphql name is "postAuthorFields"), of which one of the fields is a group of related posts by that author.
What I want to be able to do in the simplified below query is add an "order by date DESC" sort of command on the posts connection. I know this isn't supported out of the box on the plugin and have read the many posts and reasonings on that, so I get it. The efficiency concerns in question are noted and understood, but not relevant to my use case. For all of my other opt-in custom orderings, I'm doing various register_graphql_field actions in my own plugin to add these orders, but on this one, I can't figure out on this one which connection I should register the extra arguments on (either as ...WhereArgs or even just as a boolean to sort at the main level of arguments, given there aren't other Where args present in this connection).
query PostAuthors($author: ID!) {
postAuthor(id: $author, idType: SLUG) {
id
title
postAuthorFields {
authorPosition
bio
posts(first: 20) {
nodes {
slug
}
}
}
}
}
This is the sort of simplified action I'd imagine registering if it wasn't a where arg, but what field would I be registering it against in the above? I have a feeling it would be something along the lines of PostAuthorToAcfContentNodeConnection but it's not quite that...
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm trying to figure out how to order the related posts from a field group, using 2.0.0. In this case specifically I have a custom Author post type ("post_author" is the registered post type), which then has a field group (registered graphql name is "postAuthorFields"), of which one of the fields is a group of related posts by that author.
What I want to be able to do in the simplified below query is add an "order by date DESC" sort of command on the posts connection. I know this isn't supported out of the box on the plugin and have read the many posts and reasonings on that, so I get it. The efficiency concerns in question are noted and understood, but not relevant to my use case. For all of my other opt-in custom orderings, I'm doing various register_graphql_field actions in my own plugin to add these orders, but on this one, I can't figure out on this one which connection I should register the extra arguments on (either as ...WhereArgs or even just as a boolean to sort at the main level of arguments, given there aren't other Where args present in this connection).
This is the sort of simplified action I'd imagine registering if it wasn't a where arg, but what field would I be registering it against in the above? I have a feeling it would be something along the lines of PostAuthorToAcfContentNodeConnection but it's not quite that...
Thanks for any nudges in the right direction! Even if just how to read the schema properly...
Beta Was this translation helpful? Give feedback.
All reactions