[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 Jan 29 22:52:05 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):
Replying to [comment:4 nacin]:
> This is awesome. Most excellent work.
Thanks!
> The only thing I see is remove() should probably occur immediately,
within the post_clauses callback. This isn't just for academic or style
reasons — if someone else runs a WP_Query on a hook of WP_Query (careful
to avoid recursion, etc.), this would stomp over that.
Done in [attachment:26937.4.patch]. Nice catch!
> I also could picture each clause manipulation being its own protected
method, with filter() handling the has_filter() checks. Just to split up
the logic a bit. If it doesn't make it easier to read/grok though, please
push back on it.
I went ahead and split the manipulations into their own methods in
[attachment:26937.4.patch]. I'm not sure it improves readability, but I'm
also not convinced it makes things less comprehensible. If no one
expresses any strong feelings either way, I'm happy with leaving the
methods split as they are in the latest patch.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/26937#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list