Prev / Next Post Same taxonomy Custom Post Type

by Lear2000   Last Updated March 14, 2019 20:08 PM - source

I have a custom post type "cases" and a custom taxonomy "before-after-gallery". On my single-case.php my prev and next post links are jumping from one category to another.

    <?php next_post_link('%link', 'Next Case', TRUE , null , 'before-after-gallery');?>

I am telling WP to stay in the same term and not sure why its jumping. I have spent hours trying multiple solutions but no matter what I can not get the post to stay in the same category.

This only happens on the cases in which have multiple terms on each case. I have tried to omit the other terms but I can not find a way to say "this is my current term" and get the id of that term and omit others.

Running a standard wp loop



Related Questions



Get terms from current WP Query

Updated May 07, 2017 01:08 AM

Output taxonomy terms if uses another taxonomy

Updated September 10, 2017 18:08 PM

return only the first two terms of custom post

Updated October 11, 2017 06:08 AM