[wp-trac] [WordPress Trac] #26937: get_adjacent_post() should use WP_Query rather than build its own SQL query

WordPress Trac noreply at wordpress.org
Mon Mar 17 20:45:18 UTC 2014


#26937: get_adjacent_post() should use WP_Query rather than build its own SQL query
-------------------------+-----------------------
 Reporter:  ethitter     |       Owner:  nacin
     Type:  enhancement  |      Status:  reopened
 Priority:  normal       |   Milestone:  3.9
Component:  Query        |     Version:  3.7
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:
-------------------------+-----------------------

Comment (by ethitter):

 [attachment:26937.7.patch] builds on Nacin's patch from
 [attachment:26937.2.diff], adding the aliasing of `wp_posts` as `p` in the
 resulting SQL. [attachment:26937.7.patch] also updates the related unit
 tests, which are passing.

 Nacin's patch fixed the sticky post issue in my testing.

 I'm reviewing the backwards compatibility issues with the `WHERE` filter
 [comment:21 noted by Kovshenin].

 I haven't yet checked into the [comment:26 potential repetition or
 looping] when posts are published with identical timestamps, but since the
 date restriction in the query just uses `WP_Date_Query`, I fear the
 problem may exist outside of the `WP_Adjacent_Post` class's use of
 `WP_Query`.

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


More information about the wp-trac mailing list