I'm trying to make previous_post_link() and next_post_link() work inside a custom post type, inside a same category (taxonomy) but its not working.

It this posible ?

I'm trying:

<?php previous_post_link('<div class="posts-next">%link</div>', 'Next in category',TRUE); ?>

2 Answers 2


I'd suggest using a plugin for this. next_post_link and previous_post_link will use the category taxonomy (literally)*, so they will not work as expected with custom taxonomies, which I think you are using here.

I've used both Smarter Navigation by Scribu and Ambrosite Next/Previous Post Link Plus, which are both great plugins for this sort of thing.

*See the source for get_adjacent_post() which is used by WP's next/previous_post functions in \wp-includes\link-template.php to see how "category" is hard-coded.


The taxonomy is no longer hardcoded for next_post_link and previous_post_link you just need to specify it in the last parameter

<?php next_post_link( $format, $link, $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ); ?>

See documentation

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.