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!

2 Answers 2


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/


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.

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.