#21003 closed enhancement (fixed)
WP_Comment_Query with WP_Meta_Query integration
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 3.5 |
| Component: | Comments | Version: | 3.4 |
| Severity: | normal | Keywords: | has-patch needs-testing |
| Cc: | georgemamadashvili@… |
Description
Basically the title says it all. What I'd like to see in WordPress is an implementation of the WP_Meta_Query that was intorduced in 3.2 for the comments query as well as ordering by meta values.
Basically if those features are implemented, developers will have greater flexibility about comments - the first things that come to mind are rating system(I know there should be a plugin out there for that already), separating comments by some parameter(let's say age/sex/country/etc, if there is some kind of sociological study) and many more.
I stumbled upon this quite recently when I was making an extension for qTranslata and I had to get comments by specific meta value - I had to either write custom MySQL(at which I'm not really good), or implement the meta query.
I'm attaching the diff file that I made(I've tested that with 3.4) for wp-includes/comments.php
Attachments (5)
Change History (17)
nikolov.tmw — 11 months ago
Unit tests can go here: http://unit-tests.trac.wordpress.org/browser/trunk/tests/comment.php#L8
Replying to ryan:
Unit tests can go here: http://unit-tests.trac.wordpress.org/browser/trunk/tests/comment.php#L8
Which I just moved to http://unit-tests.trac.wordpress.org/browser/trunk/tests/comment/query.php
The last assertion in those tests fails. The same comment occurs twice in the results.
- Keywords commit removed
In WP_Query, we have this for dealing with duplicates:
if ( !empty( $this->tax_query->queries ) || !empty( $this->meta_query->queries ) ) {
$groupby = "{$wpdb->posts}.ID";
}
- Owner set to ryan
- Resolution set to fixed
- Status changed from new to closed
In [22074]:
comment:10
in reply to:
↑ 9
duck_ — 8 months ago
- Resolution fixed deleted
- Status changed from closed to reopened
comment:11
ryan — 8 months ago
- Resolution set to fixed
- Status changed from reopened to closed
In [22079]:
comment:12
SergeyBiryukov — 4 months ago
Follow-up: #23208

Patch for integrating meta_query and meta_value ordering for comments queries