WordPress.org

Make WordPress Core

#22901 closed defect (bug) (invalid)

wp.getComments doesn't accept an array of statuses anymore.

Reported by: stuffmc Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.5
Component: XML-RPC Keywords:
Focuses: Cc:

Description

Between 2.7 and 3.5 Beta I could not only give a status as a text but as well as an array, allowing to retrieve in one call the "hold" and "approve" comments. As of 3.5 final, sending an array of statuses returns an empty array of comments.

Change History (7)

comment:1 nacin17 months ago

  • Milestone changed from Awaiting Review to 3.5.1

Moving to 3.5.1 for investigation.

comment:2 markoheijnen17 months ago

This issue is quite interesting. From looking to the code I can't see the reason why it ever worked. Also Codex says it is string only.

comment:3 nacin17 months ago

Interesting. So, this is actually a change in WP_Comment_Query.

If you passed 'status' as an array — any array — prior to 3.5, you would have gotten comments that were "hold" (0) and "approve" (1). That's it. Even if you asked for something else.

In 3.5, what now occurs is when you pass a 'status', we query for that status. Problem is, you're passing an array, which is getting cast to Array. So, comment_status = 'Array'. That doesn't work.

This is due to the changes in #21101.

If you stop requesting 'status', wp.getComments will again return hold and approve for you.

comment:4 markoheijnen17 months ago

That was exactly what how he tries to do it: user, pwd, {number:1, status: ["approve", "hold"]}

comment:5 stuffmc17 months ago

You'll have to explain me how I got "spam" comments as well when passing ["approve", "hold", "spam"]

Version 0, edited 17 months ago by stuffmc (next)

comment:6 markoheijnen17 months ago

Well it are 2 queries then. One for approve/hold and one for spam.

You do can use the method 'system.MultiCall'. Quick search let me to this page: http://scripts.incutio.com/xmlrpc/advanced-client-construction.php.

comment:7 markoheijnen17 months ago

  • Milestone 3.5.1 deleted
  • Resolution set to invalid
  • Severity changed from major to normal
  • Status changed from new to closed

Closing the ticket as invalid since this was never possible. Was thinking about creating a new ticket for having it possible but for me it doesn't make sense if you can't have a custom status.

@stuffmc: For your application I would split approve/hold and spam. It makes no sense to have those combined from an user perspective.

Note: See TracTickets for help on using tickets.