[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 12 17:13:46 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):
Inspecting DB queries, I can count several additional ones related to
adjacent links.
In my local test environment, using _s as theme, theme unit test data, no
plugins etc. I usually have just 4 queries related to prev/next links
called by adjacent_posts_rel_link_wp_head(), previous_post_link() and
next_post_link().
But now I can count 16 queries related to next/prev links, 8 of them just
for adjacent_posts_rel_link_wp_head().
Then, when I mark a post (doesn't matter which one, just a random post but
not the one I'm currently inspecting) as "sticky" I can see 8 more
queries... a total of 16.
Moreover, both previous_post_link() and next_post_link() will print out a
link to the sticky post. If more than one sticky post, the most recent one
will be printed out.
I fear this new class runs multiple times and does something even on the
retrieved prev/next post objects, just my 2 cents but I really don't have
time to investigate deeper.
To recap, in my usual test post which is, guess it, "Post Format:
Standard", using _s theme with theme unit test data with no menus, no
widgets etc. nothing else on the post other than post content, now I have
a total of 29 queries.
As soon as I revert back to previous 'link-template.php' version, I have
a total of 13 queries, just 4 of them related to prev/next links.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/26937#comment:24>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list