Current category post loops

Hi.

I have a custom post single page template and I display related posts there (I don’t use Related block, I built it myself)

I want that related post to show only posts that are in the same category.

For example on a Greek Salad recipe single page I want related recipes to be only from the Salads category.

How can I do it with loop? Now I just fetch all the recipes, because I couldn’t find solutions and I don’t like when on salad recipe related post is from Cake category.

See this with the solution from itchy:

it doesn’t work. I don’t want to fetch taxonomy ID or name.
My loop is on the Single Recipe template and want to show related recipes by category.

You don’t fetch, you enter into taxonomy query as the parameters.

Works for me perfectly on my recipies single post template.

My settings for the query loop in the single template:

If this doesn’t work, the you make something wrong for sure.

3 Likes

Oh, I did it wrong previously. it works.

@Patric Thanks