[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
Fri Mar 14 13:45:42 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 afercia):
please correct me if I'm wrong
with 'ignore_sticky_posts' => true are you completely excluding sticky
posts from posts navigation? when I revert back, I have my sticky posts in
the post navigation and that make sense since if a theme makes use of
prev/next links, you want to navigate through posts chronologically.
Maybe it would be better to let theme authors make a decision whether to
include or not sticky posts in posts navigation?
Btw, using _s theme, I still can count 2 additional queries, now on my
test page I have a total of 15 queries, when I revert back they're 13.
Testing with different themes, I get even more queries related to adjacent
posts, I suppose this varies depending on the posts navigation function
used.
With _s, I can see 6 queries related to adjacent posts:
- 2 called by adjacent_posts_rel_link_wp_head
- 4 called by _s_post_nav
seems to me the 4 ones called by _s_post_nav are duplicated, called a
first time by WP_Adjacent_Post and then again by
previous_post_link/next_post_link which end up calling again
WP_Adjacent_Post which calls again get_posts...
Not a SQL expert here sorry I can't help more. See attachment for
duplicated queries details.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/26937#comment:28>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list