Title: Query loop: showing same category as current post
Last modified: August 8, 2023

---

# Query loop: showing same category as current post

 *  [Resy](https://wordpress.org/support/users/selectedbymila/)
 * (@selectedbymila)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/query-loop-showing-same-category-as-current-post/)
 * Hi there,
 * Currently I am trying to set up the query loop in the template for my posts. 
   Within the query loop you can select one or more categories via the taxonomies.
   That is clear to me. However, ideally I want that when I view a post, I only 
   see the other articles from the same parent category.
 * So for example I have a post within my category Productivity, then at the end
   of the post I want to see 3 articles that are also from the Productivity category
   and not from the Time Management category. And when I go to a post from the Career
   category, I want to see other articles from the Career category and not from 
   Productivity. This query loop I want to include within the template, so I can
   avoid that I need to add this to the post itself everytime I create a new one.
 * Is there a way to set this up? I am no expert in coding – not at all… Hopefully
   someone can help me with this. Thanks in advance!

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [doubleedesign](https://wordpress.org/support/users/doubleedesign/)
 * (@doubleedesign)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/query-loop-showing-same-category-as-current-post/#post-16955953)
 * Can you share the code your currently have in the template?
 *  Thread Starter [Resy](https://wordpress.org/support/users/selectedbymila/)
 * (@selectedbymila)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/query-loop-showing-same-category-as-current-post/#post-16955975)
 * Thanks for the quick reply!
 * I don’t use a code, I use the native “query loop” block within FSE.
 *  [annapoorna](https://wordpress.org/support/users/annapoorna/)
 * (@annapoorna)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/query-loop-showing-same-category-as-current-post/#post-16956184)
 * thank you
 *  Thread Starter [Resy](https://wordpress.org/support/users/selectedbymila/)
 * (@selectedbymila)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/query-loop-showing-same-category-as-current-post/#post-16956835)
 * It just occurred to me that I can of course see the code via the code editor (
   via appearance > editor > templates > [the template in which I use the query 
   loop]). This is it:
 *     ```wp-block-code
       <!-- wp:query {"queryId":16,"query":{"perPage":3,"pages":0,"offset":0,"postType":"post","order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":false},"displayLayout":{"type":"flex","columns":3},"layout":{"type":"constrained"}} -->
   
       <div class="wp-block-query"><!-- wp:post-template -->
   
       <!-- wp:post-featured-image {"isLink":true} /-->
   
       <!-- wp:post-date {"style":{"typography":{"fontSize":"11px"}}} /-->
   
       <!-- wp:post-title {"isLink":true,"style":{"spacing":{"margin":{"top":"0px","right":"0px","bottom":"0px","left":"0px"}}}} /-->
   
       <!-- /wp:post-template --></div>
   
       <!-- /wp:query --></div>
       ```
   
 *  Thread Starter [Resy](https://wordpress.org/support/users/selectedbymila/)
 * (@selectedbymila)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/query-loop-showing-same-category-as-current-post/#post-16973324)
 * Is there anyone from support who can help with this?

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Query loop: showing same category as current post’ is closed to new replies.

## Tags

 * [query loop](https://wordpress.org/support/topic-tag/query-loop/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 5 replies
 * 3 participants
 * Last reply from: [Resy](https://wordpress.org/support/users/selectedbymila/)
 * Last activity: [2 years, 10 months ago](https://wordpress.org/support/topic/query-loop-showing-same-category-as-current-post/#post-16973324)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
