0

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?

2
  • 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). Commented Jun 20, 2013 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
    Commented Jul 11, 2020 at 9:20

1 Answer 1

2

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.

5
  • Can you explain how this would work? Also, posts with exactly the same time-stamp should be very rare.
    – s_ha_dum
    Commented Jan 14, 2014 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. Commented Jan 15, 2014 at 22:27
  • The database uses a MySQL datetime column. That includes seconds.
    – s_ha_dum
    Commented Jan 15, 2014 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. Commented Jan 16, 2014 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
    Commented Jan 28, 2016 at 9:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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