[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
Wed Mar 19 22:36:01 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):

 Replying to [comment:32 ethitter]:
 > Another possible solution, and the one I'm inclined towards, is to
 simply prepend `WHERE 1=1` to the relevant clause as it goes to the legacy
 filter, and strip out any `WHERE` that the filter returns, while also
 ensuring the filter's return value starts with `AND` as it does initially
 in `WP_Query`. This approach requires considerably-less string
 manipulation, which seems a plus given there's already enough of that in
 the `filter_sort()` method.

 [attachment:26937.10.patch] implements the above-described approach to the
 `WHERE` clause backcompat. I've added an additional unit test for this
 particular situation.

 Of the issues that triggered this ticket's reopening, only the
 [https://core.trac.wordpress.org/ticket/26937#comment:26 possibility of
 repetition or looping] needs to be investigated still. The remaining
 issues are covered as part of [attachment:26937.10.patch].

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


More information about the wp-trac mailing list