[wp-trac] [WordPress Trac] #16316: Enable pagination for the XML-RPC getRecentPosts function

WordPress Trac wp-trac at lists.automattic.com
Thu Jan 20 12:50:46 UTC 2011


#16316: Enable pagination for the XML-RPC getRecentPosts function
-------------------------+-----------------------------
 Reporter:  feedfabrik   |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  XML-RPC      |    Version:  3.1
 Severity:  minor        |   Keywords:
-------------------------+-----------------------------
 To retrieve posts via the XML-RPC API, currently the following methods can
 be called:
  * blogger.getRecentPosts
  * metaWeblog.getRecentPosts
  * mt.getRecentPostTitles

 In changeset r16256 these methods were enhanced to support an optional
 number of posts. However, the query still always starts from the most
 recent post and there is no way to retrieve older posts without increasing
 the optional number of posts to a sufficiently large number and retrieving
 everything before as well. This can place an unnecessary and unwanted
 burden on the server.

 There is an alternative of requesting a post by ID but for this the ID
 needs to be known in advance. Until ticket #6850 is addressed, there is no
 way to query for specific IDs.

 I would like to suggest an enhancement that leverages r16256 and
 introduces another optional parameter for offset.

 As an example, the code for blogger_getRecentPosts would get an
 additional:
 {{{
 if ( isset( $args[5] ) )
     $query['offset'] = absint( $args[5] );
 }}}

 That should be enough to get {{{wp_get_recent_posts}}} from {{{post.php}}}
 do the job.

 On more general terms, a new XML-RPC method {{{wp.getPosts}}} could be
 introduced that simply accepts the array used in {{{wp_get_recent_posts}}}
 for even more flexibility, but that's probably stuff for another ticket.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16316>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list