WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In this answer -- How to Get Next or Previous Post in a Specific Tag? -- a working function is provided to generate "next/prev" links by tag rather than category.

How could one make this so that you can specify exactly which tag to generate next/previous links for? As it is, it appears to only allow you to exclude tags from consideration. As posts tend to have many tags, it's seems unreliable (with the function as-is) to reply on the in_same_tag option.

share|improve this question

I would check out the Ambrosite Next/Previous Post Link Plus plugin which gives you a lot of arguments to pass to the "improved" next/prev link functions made by the plugin. I recently needed this type of functionality and this plugin worked great.

With the plugin, you get to do stuff like this:

<?php next_post_link_plus( array('in_cats' => '3,5') ); ?>
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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