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

I am trying to find out if it is possible to pass certain parameters to next_post_link() and previous_post_link() to make it only show other custom posts that have the same custom taxonomy values choosen?

In my case i have a custom post type named "houses" and two custom taxonomies called "num_floors" and "collection"

If a user is on a single house page i want next/prev links only to other houses with the same value for num_floors and collection as the one currently viewed..

Appreciate your help!

share|improve this question

There is no parameter for taxonomy in that function. But you can use them to look for posts in the same 'category', i.e. they are hardcoded to work with only 'category'

You might want to use this plugin http://wordpress.org/extend/plugins/previous-and-next-post-in-same-taxonomy/

share|improve this answer
Thank you, will have a look at this. – jonas Oct 26 '12 at 7:35

I ended up doing a custom function in functions.php where i queried all the posts according to the needs and then looped trough them and compared the position to the current post id, returning links.

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.