[wp-trac] [WordPress Trac] #36904: Add caching to comment feed in WP_Query
WordPress Trac
noreply at wordpress.org
Sun Jun 18 16:29:05 UTC 2017
#36904: Add caching to comment feed in WP_Query
--------------------------+-----------------------------
Reporter: spacedmonkey | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Future Release
Component: Query | Version: 2.2
Severity: normal | Resolution:
Keywords: needs-patch | Focuses: performance
--------------------------+-----------------------------
Changes (by boonebgorges):
* keywords: needs-unit-tests has-patch => needs-patch
Comment:
I've spent some time with the latest patch, and it seems to do pretty well
with single-post comment feeds - example.com/2017/05/foo/comments/feed/.
[attachment:36904.4.patch] is a slightly cleaned-up version, with an
initial pass at a technique for having at least a tiny bit of test
coverage.
But the patch, as written, breaks the main comment feed:
example.com/comments/feed/. This feed should fetch the latest 10 comments
from all published posts (10 being the default posts_per_rss):
{{{
SELECT wp_comments.* FROM wp_comments JOIN wp_posts ON (
wp_comments.comment_post_ID = wp_posts.ID ) WHERE ( post_status =
'publish' OR ( post_status = 'inherit' AND post_type = 'attachment' ) )
AND comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 10
}}}
With [attachment:36904.4.patch], it fetches the last 10 comments *that
belong to the last 10 posts*. Any comments from posts 11+ will not be
included.
@spacedmonkey Could you take this back to the drawing board a bit? It
seems that removing the `// Comment feeds` block and doing all processing
after the main posts query is responsible for this problem. It might turn
out that we'll need to continue to do something in that part of the query
generation, whether it's setting some sort of flag (it's not clear to me
what that'd look like, but maybe you can figure it out) or just calling
`WP_Comment_Query` in both places.
If we get a version with everything working, it seems like a good call for
4.9.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/36904#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list