Fixing Broken Posts Navigation

Add css classes to WordPress posts links generated by next_post_link and previous_post_link functions
Add css classes to WordPress posts links generated by next_post_link and previous_post_link functions
June 19, 2015
Show all

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.

Sher Ali Saafi
Sher Ali Saafi
Sher Ali Saafi is a software engineer, WordPress Rockstar and Envato Elite Author. When he is not found in front of machines then he is most probably somewhere in the mountains to explore new territories. You can find his travel photography at http://sheraliphotography.com/ and read about his travel experiences at http://thesilenttraveler.com/

Leave a Reply

Your email address will not be published. Required fields are marked *