I have a single page template for one of my custom post types. Are the top of this page I have...

<?php previous_post_link('%link', 'Prev Project'); ?>

<?php next_post_link('%link', 'Next Project'); ?>

These links seem to skip some posts, but not all of them. Any idea?

  • 3
    What kind of posts do they skip? Is there any rule in this skipping? Does it occur even when all plugins are disabled (maybe some plugin adds filters that exclude some posts from this links). – Krzysiek Dróżdż Jun 20 '13 at 19:22
  • I tried fixing the timestamps but it didn't do the trick. My blog is skipping a few posts to the next category of posts. Any suggestions about what I can do? – Srikara Jul 11 at 9:20

Check the published date/time for the skipped posts. You will run into problems with posts published at the same time as the current post's publish time.

| improve this answer | |
  • Can you explain how this would work? Also, posts with exactly the same time-stamp should be very rare. – s_ha_dum Jan 14 '14 at 23:54
  • I think resolution is just down to the minute, so it is possible. I ran into it with posts generated in scripts. I fixed it by updating the post times to be different times in the order I wanted. – deCastongrene Jan 15 '14 at 22:27
  • The database uses a MySQL datetime column. That includes seconds. – s_ha_dum Jan 15 '14 at 22:39
  • You are correct, the datetime needs to match to the second. The posts would have to be created within a second of each other as with my script. Or multiple users could create posts at the same second. – deCastongrene Jan 16 '14 at 3:49
  • Can confirm this issue on WP 3.9.10 (yeah it's really time to update). Had two posts with the same date. – luke Jan 28 '16 at 9:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.