Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

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') ); ?>
share|improve this answer

Your Answer

 
discard

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.