I can’t seem to find anything on this subject on the internet. The basic function works perfectly fine. The issue starts when i try to filter things in the same category or exclude categories:
get_next_post(); // returns a perfectly normal object which contains the data of the next post get_next_post(true); // returns an empty object, even if there are a lot more posts in the same category get_next_post(false, '34'); // returns an empty object, even if there are more posts in other categories except 34
Has anyone encountered this error?
I think i’ve answered my own question here… get_adjacent_post() (from wp-includes/link-template.php) use the “category” to search in the WP database. This is obviously limited, because any CPT categories are “cpt_category”, so the query is wrong from the start. I guess the only solution would be to fork the function inside the theme..
yes you are right, we ran into this issue too. Maybe this article here helps you: http://www.billerickson.net/previous-and-next-post-in-same-taxonomy/