Make WordPress Core

Opened 12 years ago

Closed 9 years ago

Last modified 9 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:


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(

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)

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. This is particularly important because I have more comment types than I want to display, so displaying all the types would not work.

Last edited 12 years ago by vhauri (previous) (diff)

#3 @borkweb
10 years ago

  • Keywords has-patch added
  • Version set to 3.8.1

#4 @SergeyBiryukov
10 years ago

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

#6 @ragulka
9 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
9 years ago

  • Keywords 4.0-early removed

Related: #12668.

#8 @boonebgorges
9 years ago

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

#9 @boonebgorges
9 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 9 years ago by boonebgorges (previous) (diff)
Note: See TracTickets for help on using tickets.