WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 23 months ago

#20723 closed defect (bug) (fixed)

wp.getPosts xmlrpc using "number" when it should be using "numberposts"

Reported by: djcp Owned by: ryan
Milestone: 3.4 Priority: normal
Severity: normal Version: 3.4
Component: XML-RPC Keywords: api has-patch commit
Focuses: Cc:

Description

See $SUBJECT. Using "number" to limit the number of posts returned is incorrect, as wp_get_recent_posts() expects this parameter to be called "numberposts".

A patch is attached to fix the parameter name to be "numberposts" - though we could have the API externally expose "number" yet give the parameter "numberposts" to wp_get_recent_posts().

Attachments (2)

20723.patch (1020 bytes) - added by SergeyBiryukov 2 years ago.
Also corrects PHPDocs
class-wp-xmlrpc-server.php.patch (570 bytes) - added by djcp 2 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 djcp2 years ago

  • Keywords has-patch added

comment:2 djcp2 years ago

To clarify, this means setting the number of posts that wp.getPosts returns is busted.

SergeyBiryukov2 years ago

Also corrects PHPDocs

comment:3 SergeyBiryukov2 years ago

  • Milestone changed from Awaiting Review to 3.4

Related: #18433

The change happened in ticket:18433:wp.getPosts.6.patch, the earlier patches used numberposts.

comment:4 ryan2 years ago

numberposts is ancient cruft. I'd rather not bubble it up. How about exposing number in wp.getPosts and passing it along as numberposts per the alternative suggested in the description.

comment:5 djcp2 years ago

Done and attached. No changes necessary to the phpdocs (but thanks for that before, Sergey) as the external API provided by wp.getPosts is the same.

comment:6 SergeyBiryukov23 months ago

  • Keywords commit added

comment:7 ryan23 months ago

We need some wp_getPosts unit tests.

comment:8 ryan23 months ago

  • Owner set to ryan
  • Resolution set to fixed
  • Status changed from new to closed

In [20846]:

Fix post limiting in wp_getPosts(). Props djcp. fixes #20723

Note: See TracTickets for help on using tickets.