• Resolved therealgilles

    (@chamois_blanc)


    If I run the following query:

    query MyQuery {
      posts(first: 10) {
        nodes {
          title
          categories {
            nodes {
              name
            }
          }
        }
      }
    }

    I only get the first category listed for each post. Is there a way to get all of them?
    Thanks for any advice.

Viewing 1 replies (of 1 total)
  • Plugin Author Jason Bahl

    (@jasonbahl)

    @therealgilles the above query should return the first 10 categories associated with each post.

    You can get more than 10 like so:

    
    
    query MyQuery {
      posts(first: 10) {
        nodes {
          title
          categories(first:100) {
            nodes {
              name
            }
          }
        }
      }
    }

    If you need more than 100, you would need to paginate, or filter the server to allow more than 100 to be returned (not highly recommended as it can cause server processing issues).

Viewing 1 replies (of 1 total)
  • The topic ‘How to query some posts and then get all their categories’ is closed to new replies.