[wp-trac] [WordPress Trac] #22040: wp_dashboard_recent_comments queries do not skip comment_approved=spam
WordPress Trac
wp-trac at lists.automattic.com
Fri Sep 28 18:23:26 UTC 2012
#22040: wp_dashboard_recent_comments queries do not skip comment_approved=spam
-------------------------------+------------------------------
Reporter: _ck_ | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Performance | Version:
Severity: normal | Resolution:
Keywords: reporter-feedback |
-------------------------------+------------------------------
Comment (by _ck_):
Replying to [comment:1 nacin]:
> What version of WordPress are you running?
.
I realize the query was changed after 3.2 but here's the thing - your
default query in 3.4 and 3.5 is:
` $comments_query = array( 'number' => $total_items * 5, 'offset' => 0 );
`
then `class WP_Comment_Query {` sets a default status of `'status' => '',`
which allows any status to be returned, so there is STILL no filtering on
the comment_status
Then you still proceed to loop through the results via PHP instead of
using mysql to filter.
Moderated posts are okay to return but spam should be excluded at the
mysql level.
Unless akismet already filters the query. Which I do not see offhand in
it's code and since the query is not named, I don't see how it could know
to filter it in just in the dashboard box without a trigger.
So the resposibility of the dashboard box is to only fetch
`comment_approved` = approved or moderated.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/22040#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list