title: How to get related post by category in headless wordpress?(GraphQL)
body: <p>My problem is that object is very deep and somewhere I make a mistake that I cannot see. I want to display related post to post which someone click. I fetch date by GraphQL via Wordpress to headless cms nextjs page.</p>
  <p>in one component I have selected categories</p>
  <pre><code>  const postCategory = post.categories.edges[0].node.name
  </code></pre>
  <p>and this posts with this category I want to display as related posts:</p>
  <pre><code>posts.
  filter((cat) =&gt; { return(
              cat.categories.edges.map((z) =&gt; z.node.name == postCategory)
           
          )})
  </code></pre>
  <p>anyone make similar project and see my mistakes?</p>