3801 posts
  • Became a Top 20 Author of the Month
  • Had an item that was trending
  • Sells items exclusively on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+11 more
KrownThemes
says

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?

3801 posts
  • Became a Top 20 Author of the Month
  • Had an item that was trending
  • Sells items exclusively on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+11 more
KrownThemes
says

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

97 posts Be different!
  • Became a Top 20 Author of the Month
  • Had an item that was trending
  • Had an item that became a weekly top seller
  • Power Elite Author: Sold more than $1M on Envato Market
+6 more
UnitedThemes
says

Hi Ruben,

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/

3801 posts
  • Became a Top 20 Author of the Month
  • Had an item that was trending
  • Sells items exclusively on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+11 more
KrownThemes
says

Thanks for the link! :)

by
by
by
by
by
by