Fixing Broken Posts Navigation

Broken Next Previous Posts Navigation

According to the WordPress codex the get_previous_post and get_next_post should either return null or empty in single posts navigation when you are at the first or last post. If you come across a situation where these two handy functions do not work as expected then most probably you have installed a plugin which is interfering with the posts order hence breaking the functionality of get_previous_post and get_next_post functions. One of those plugins is Post Types Order. If you have installed Post Types Order then try disabling it to see if that resolves the problem for you.



The same case applies to get_adjacent_post because both get_previous_post and get_next_post use get_adjacent_post for the posts navigation in the single post template.

,