WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Next Post Previous Post not working when articles have same publish date/time

[Resolved] Next Post Previous Post not working when articles have same publish date/time

  • I’m setting up a WP installation for a publication that was previously running on a custom database solution. Their article tables did NOT have a standard data/time stamp for the published data so during import to WP, I had to auto inject the data/time.

    Since I didn’t realize this was going to be an issue, I simple injected a date/time stamp based on the “issue month” For example, all articles published in the January 2009 issue of the magazine got a timestamp of:

    2009-01-01 06:00:00

    Generally speaking there are 35 articles for each month/year combo going back to 1996.

    The problem with this is that the “next_post_link” and “previous_post_link” do not work now. Instead of going one article by the next, it’s going an entire month by month, displaying the first article it finds with a new date.

    Is there a way to fix this without having to go back and fix the dates in the database? I really do not wanna do that 😉

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hoping that using Template_Tags/previous_posts_link and Template_Tags/next_posts_link resolves the issue for you…

    Thanks for the response.

    The problem I’m having is with next_post_link, not next_posts_link. I’m on a single page, scrolling from one post to the next, not a block of posts like on the index page.

    I don’t believe there’s a way around this in WP and I think it’s one of those, “not really a bug” things, but one of those weird anomalies that crops up when users starting using the system. Who would have ever thought a post would have an identical date/timestamp to 30 other posts? Note to self.

    I wrote a program to generate the SQL to update the records since it’s probably better to have the data sanitized than not. Now everything is working as it should.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Next Post Previous Post not working when articles have same publish date/time’ is closed to new replies.
Skip to toolbar