WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#29189 closed enhancement (fixed)

post/comment IN and NOT IN params for WP_Comment_Query

Reported by: boonebgorges Owned by: boonebgorges
Milestone: 4.1 Priority: normal
Severity: normal Version:
Component: Comments Keywords: has-patch
Focuses: Cc:
PR Number:

Description

WP_Comment_Query would be much more useful if it natively supported the following parameters: 'post_id__in', 'post_id__not_in', 'comment_id__in', 'comment_id__not_in'. (One possible use case: a plugin that hides certain comments based on user permissions.)

The attached patch is a simple implementation of these four parameters, with unit tests.

Attachments (2)

29189.patch (4.8 KB) - added by boonebgorges 5 years ago.
29189.2.patch (5.3 KB) - added by boonebgorges 5 years ago.

Download all attachments as: .zip

Change History (11)

@boonebgorges
5 years ago

#1 @boonebgorges
5 years ago

  • Keywords has-patch added

#2 @wonderboymusic
5 years ago

  • Milestone changed from Awaiting Review to Future Release

4.1

#3 @boonebgorges
5 years ago

  • Milestone changed from Future Release to 4.1
  • Owner set to boonebgorges
  • Status changed from new to assigned

#4 follow-up: @DrewAPicture
5 years ago

  • Keywords needs-docs added

In looking at WP_Comment_Query::query() I notice that it's generally devoid of inline documentation. I'd at the very least prefer to see some single-line comments explaining what's being parsed for these four added arguments, as well as an @since 4.1.0 tag for the added arguments.

Looks like the default args aren't documented in here either, but we'll take care of that over in #28298.

This ticket was mentioned in IRC in #wordpress-dev by boonebgorges. View the logs.


5 years ago

#6 in reply to: ↑ 4 @boonebgorges
5 years ago

  • Keywords needs-docs removed

Replying to DrewAPicture:

In looking at WP_Comment_Query::query() I notice that it's generally devoid of inline documentation. I'd at the very least prefer to see some single-line comments explaining what's being parsed for these four added arguments, as well as an @since 4.1.0 tag for the added arguments.

Looks like the default args aren't documented in here either, but we'll take care of that over in #28298.

29189.2.patch adds inline comments, @since for the new params, and missing @ticket numbers for the tests.

#7 @DrewAPicture
5 years ago

The added docs in 29189.2.patch look great!

#9 @boonebgorges
5 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

Forgot to hit this one too in the commit message. r29808

Note: See TracTickets for help on using tickets.