[wp-trac] [WordPress Trac] #42936: get_adjacent_post won't find any posts that are published in the same minute

WordPress Trac noreply at wordpress.org
Thu Oct 29 17:42:56 UTC 2020


#42936: get_adjacent_post won't find any posts that are published in the same
minute
--------------------------------------+---------------------
 Reporter:  sheepysheep60             |       Owner:  (none)
     Type:  defect (bug)              |      Status:  new
 Priority:  normal                    |   Milestone:  5.6
Component:  Posts, Post Types         |     Version:  4.9.1
 Severity:  normal                    |  Resolution:
 Keywords:  good-first-bug has-patch  |     Focuses:
--------------------------------------+---------------------

Comment (by oglekler):

 There is no way to get rows in the same order in which they are stored in
 a database for sorting purposes.

 The solution can be is to get all ID's with the same post_date and if
 they're more than one, for the previous post take the previous in this
 result if it exists, and if not - get the post with a date less than the
 current date, and exactly the same process for next post. An alternative
 solution could be to check the post_date before save / update and make it
 unique by adding some amount of milliseconds.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/42936#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list