WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 3 years ago

#12904 closed enhancement (fixed)

get_comments(): Enable post_status, post_type

Reported by: zeo Owned by: jorbin
Milestone: 3.2 Priority: normal
Severity: normal Version:
Component: Comments Keywords: needs-patch
Focuses: Cc:

Description

To better extend and improve get_comments() to be use in various ways. Enable get_comments() to retrieve comments based on post 'post status', or post 'post type'.

Currently, even with comment 'status' = approve, it will fetch all comments regardless of 'post status' or 'post type'.

Thoughts?

Attachments (1)

get_comments.diff (1.6 KB) - added by zeo 4 years ago.
refresh patch

Download all attachments as: .zip

Change History (14)

comment:1 nacin4 years ago

  • Keywords early added
  • Milestone changed from 3.0 to 3.1

Patch is doing a bit too much work. We have various helper functions here that can help: get_post_stati, get_post_types, wp_parse_args|str, etc.

comment:2 zeo4 years ago

  • Keywords needs-patch added; has-patch removed

zeo4 years ago

refresh patch

comment:3 zeo4 years ago

  • Keywords needs-refresh dev-feedback needs-testing added

comment:4 zeo4 years ago

  • Cc zeo@… added

comment:5 zeo4 years ago

  • Milestone changed from 3.1 to 3.0

This ticket need early attention, because of this changeset [14483]. Even though the comment in Private, or Draft? post is not accessible but it still appear in Recent Comments listing.

comment:6 nacin4 years ago

  • Keywords early needs-refresh dev-feedback needs-testing removed

Patch still does too much work. See also wp_parse_args.

comment:7 zeo4 years ago

nacin, obviously you got it. Feel free to fix this. Thanks.

comment:8 jorbin4 years ago

  • Cc aaron@… added
  • Owner set to jorbin
  • Status changed from new to assigned

I'm going to take a crack at this now.

comment:9 follow-up: nacin4 years ago

  • Milestone changed from 3.0 to 3.1

comment:10 in reply to: ↑ 9 jorbin4 years ago

It's to late in the process for 3.0 to modify the get_comments query. This will need some early attention in the 3.1 cycle to make sure there are no performance penalties

comment:11 nacin3 years ago

  • Milestone changed from Awaiting Triage to Future Release

comment:12 ryan3 years ago

  • Milestone changed from Future Release to 3.2

comment:13 ryan3 years ago

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

(In [17667]) Allow retrieving comments by post type, status, author, author, name, or parent. Fetch only published posts for recent comments widget. Props filosofo. fixes #16506 #12904

Note: See TracTickets for help on using tickets.