I have a custom post type “realisation”, for which I’ve made a file single-realisation.php
. These posts use the non-custom taxonomy “category”. In this page, I use the next_post_link()
and previous_post_link()
functions, with the in_same_term
parameter set to TRUE. I’ve also tried to set the other parameters to ‘ ‘ and ‘category’ (as the site was made prior to 3.8, I believe).
My problem is the category doesn’t seem to be taken into account. The links do appear but will lead to the next or previous realisation posts in order of creation, ignoring the category the current post is in.
Yet everything else concerning the category seems to work. I fetch it using $categorie = get_the_category()
and then echo that with $category[0]->name
and the category’s name does appear correctly. And this is all inside the loop, of course.
I’ve also tried var_dumping get_next_post()
and get_adjacent_post()
with in_same_term
set to true and it’s always the same result; I get the immediate next realisation post despite the category.
Is there something special I should be doing when I’m trying to use the vanilla categories with custom post types with next_post_link()
and previous_post_link()
? Perhaps the syntax of the taxonomy parameter?