WordPress.org

Make WordPress Core

Opened 4 months ago

Closed 4 months ago

Last modified 4 months ago

#50528 closed defect (bug) (reported-upstream)

The documentation of WP_Comment_Query is incorrect

Reported by: dinhtungdu Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Comments Keywords:
Focuses: docs Cc:

Description

See: https://developer.wordpress.org/reference/classes/wp_comment_query/#more-information

When you create an instance of this class passing an array of arguments to it’s constructor, the class will automatically run the query method and return an array of comments.

This is incorrect, when we create an instance of WP_Comment_Query with non-empty argument, the class always returns an instance of WP_Comment_Query, not an array of comments. This leads to incorrect example of basic usage as well.

Change History (2)

#1 @audrasjb
4 months ago

Hi @dinhtungdu and thank you for spotting this,

I updated "Basic usage" section on DevHub accordingly: https://developer.wordpress.org/reference/classes/wp_comment_query/

#2 @audrasjb
4 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to reported-upstream
  • Status changed from new to closed

Closing this ticket as reported-upstream since it doesn't require changes on WordPress core.
Thanks again, @dinhtungdu!

Last edited 4 months ago by audrasjb (previous) (diff)
Note: See TracTickets for help on using tickets.