Make WordPress Core

Opened 12 years ago

Closed 10 years ago

Last modified 10 years ago

#21571 closed enhancement (duplicate)

Add support multiple comment types in get_comments

Reported by: borkweb's profile borkweb Owned by: boonebgorges's profile boonebgorges
Milestone: Priority: normal
Severity: normal Version: 3.8.1
Component: Comments Keywords: has-patch
Focuses: Cc:

Description

Custom comment types are a nice way to categorize comments, however, if you wish to retrieve multiple comment types you cannot use get_comments. This enhancement request (patch attached) adds support for multiple comment types a la:

$comments = get_comments( array(
  'post_id' => $post->ID,
  'type' => array(
    'a-sweet-comment-type',
    'some-other-comment-type',
  ),
));

Attachments (1)

comment.diff (588 bytes) - added by borkweb 12 years ago.
Patch for adding multiple comment_type support

Download all attachments as: .zip

Change History (10)

@borkweb
12 years ago

Patch for adding multiple comment_type support

#2 @vhauri
12 years ago

+1 I have a couple of use cases this would be very helpful for, e.g. displaying a custom comment type in a loop with regular comments, without doing multiple comment queries and then merging the resulting data.

Version 0, edited 12 years ago by vhauri (next)

#3 @borkweb
11 years ago

  • Keywords has-patch added
  • Version set to 3.8.1

#4 @SergeyBiryukov
11 years ago

  • Keywords 4.0-early added
  • Milestone changed from Awaiting Review to Future Release

#6 @ragulka
10 years ago

I'd like to weigh and add my vote for this enhancement. I'm currently working on a plugin that uses custom comment types and this would definitely make querying multiple types in a single request a lot easier.

Also, I think it makes a lot of sense, because then it would reflect the logic in WP_Query which allows querying posts using an array of post types.

#7 @boonebgorges
10 years ago

  • Keywords 4.0-early removed

Related: #12668.

#8 @boonebgorges
10 years ago

  • Owner set to boonebgorges
  • Status changed from new to reviewing

#9 @boonebgorges
10 years ago

  • Milestone Future Release deleted
  • Resolution set to duplicate
  • Status changed from reviewing to closed

Duplicate of #12668.

borkweb, thanks for the patch. As of [30096], the 'type' parameter accepts an array of types. We also now have a 'type__in' param.

Last edited 10 years ago by boonebgorges (previous) (diff)
Note: See TracTickets for help on using tickets.