[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
Sat Feb 8 20:19:38 UTC 2014


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

Comment (by ethitter):

 Following discussions with Nacin, I've completely overhauled the approach
 to adjacent post handling. [attachment:26937.5.patch] introduces a class
 that handles the adjacent post determination and makes
 `get_adjacent_post()` nothing more than a wrapper for said class. The new
 class allows for much greater flexibility, as it accepts a post
 object/ID/array for which to determine the desired adjacent post, which
 wasn't possible previously. As part of this patch, `get_adjacent_post()`
 gains the ability to specify a post, thanks to the class's capabilities.

 For those keeping track at home, the `WP_Get_Adjacent_Post::get_post()`
 method introduced in [attachment:26937.5.patch] is comprised of the
 functionality previously found in `get_adjacent_post()` in
 [attachment:26937.4.patch]. Some input validation is moved to the class
 constructor from `get_adjacent_post()`, but otherwise, the code is
 unchanged, just rearranged.

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


More information about the wp-trac mailing list