How do I show other posts from the same category as the current post when data.isPostType?

I want to show more posts from the same category as the current post but I’m not sure how can I do this, since the data object from a post does not contain items.


The categories that a post is assigned to can be found in This just shows the IDs of the categories that the post is assigned to. But with the ID you can then get the category info from state.source.category, crucially the link property.

Once you have the link of the category you want you can use a fetch inside a useEffect hook to get the posts in that category into the state - example here. Once in the state you can show them alongside the current post.

Hope this helps. Let us know how you get on with this.

Thanks, this was exactly what I needed.
I created a “KeepReading” component that receives the category object and the current post id.
Then, inside the component I list all the posts from the category, and filter out the current post so it doesn’t appear in the list.
For future reference, this is how I structured the component:

const KeepReading = ({ state, actions, category, currentPost }) => {
  useEffect(() => {
  }, []);

  const data = state.source.get(;
  const items = data.items?.filter((post) => !== currentPost);

  if (items) {
    return (
        <Title>_Keep reading</Title>
          {{ type, id }) => {
            const post = state.source[type][id];
            return (
                image={getMedia(state, post.featured_media)}

  return null

I didn’t do anything about the pagination yet but this is working for now.