Related posts won't be related

Hi there,

I’m creating a Related Posts elment with loopers.
So far I’ve been using the suggested query string:
post_type=post&posts_per_page=3&offset=0&ignore_sticky_posts=1&post__not_in%5B0%5D={{dc:post:id}}
to show posts of the same category as the current post and to exclude the current post.
But only half of it is working. The current post is excluded from the related posts but it’s not showing posts from the same category. What am I missing?

Hi @ArtOfSpring,

You need to specify the current term id into the category parameter. Your Query String look like the following one.

category={{dc:term:id}}&post_type=post&posts_per_page=3&offset=0&ignore_sticky_posts=1&post__not_in%5B0%5D={{dc:post:id}}

Hope it helps.
Thanks

Hi there,

thanks for getting back to me.
Sorry but it’s still not doing the trick for me.
There still posts of different categories displayed within related posts.

Hello @ArtOfSpring,

I would suggest you please replace the given query string with this one. Please let us know it doesn’t work for you.

category_name={{dc:term:slug}}&post_type=post&posts_per_page=3&offset=0&ignore_sticky_posts=1&post__not_in%5B0%5D={{dc:post:id}}          

Hope it helps
Thanks

That’s working! Thanks!

You are welcome @ArtOfSpring

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.