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.

1 Answer 1


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') ); ?>

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.