I want to add a code in my theme to show a Next/Previous link below the post but within the same category. I Don't need a thumbnail but if possible I would appreciated, still that's not important right now. Right now I just want to insert a code(s) to one of my PHP scripts so that it would show a next/previous link in the post.

I search on google and find some stuff But I don't know how to use them. For example, I don't know how's the next_posts_link or previous_posts_link works. Because my theme don't have the LOOP.

I use many plugins but soe doesn't work for me and the one that work doesn't show on Mobile version. Right now the one that work for me is the WP Single Post Navigation Within Category Plugin.

My website is a Movie Episode site so I want to be able to let visitors to click next to the next episode within the same Series/Category.

If there's anything you can help please, Help.

1 Answer 1


There are the core functions next/previous_post_link() that accept several arguments. The 3rd is the one that triggers in_same_cat. So if you set that one to TRUE, then you'll only get posts that are in filed under the same category.

  • What will happen if the post has more than one categories? Commented Mar 7, 2016 at 11:13
  • 1
    @sanjithedward When you look at the source, then you see that it uses get_var() in the end, which returns only one single field from a row. Meaning if there are multiple return matches, it returns only the first match. You could still use the filters to fetch other related posts.
    – kaiser
    Commented Mar 7, 2016 at 12:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.