WordPress get_adjacent_post() — skip first post

I’m using the WordPress get_adjacent_post() function to retrieve and return next and previous post data.

However I would like to always skip the first post, and have it loop back to the beginning. For example:

Read More
Post 0
Post 1
Post 2
Post 3
Post 4
Post 5

When viewing Post 1, it should show ‘Post 5’ as the previous post, rather than Post 0.

Related posts

Leave a Reply