Pass taxanomy parameters to next_post_link()?

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”

Read More

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!

Related posts

Leave a Reply

2 comments

  1. 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.