[wp-trac] [WordPress Trac] #8003: XML-RPC call to getRecentPosts does not return drafts in order

WordPress Trac wp-trac at lists.automattic.com
Wed Oct 29 18:03:57 GMT 2008


#8003: XML-RPC call to getRecentPosts does not return drafts in order
---------------------+------------------------------------------------------
 Reporter:  cfinke   |       Owner:  anonymous
     Type:  defect   |      Status:  new      
 Priority:  high     |   Milestone:  2.8      
Component:  XML-RPC  |     Version:           
 Severity:  major    |    Keywords:           
---------------------+------------------------------------------------------
 When a blogging client makes a call to metaWeblog.getRecentPosts, drafts
 that were created in the Wordpress dashboard are not being returned
 interspersed among recent published posts. Instead, drafts are only
 included after all published posts, so if a client only requests the 10
 most recent entries and there are more than 10 published posts in the
 history of the blog, no drafts will be returned.

 The problem lies in this line in wp-includes/post.php in the function
 wp_get_recent_posts, which is used by xmlrpc.php to return a list of
 posts:

 $sql = "SELECT * FROM $wpdb->posts WHERE post_type = 'post' ORDER BY
 post_date DESC $limit";

 Looking in my database, any time a draft is created via the Wordpress
 dashboard, it has a zeroed-out post_date and a post_type of 'post', but a
 new entry is immediately created after it that has an accurate post_date
 but a post_type of 'revision'.  Either this behavior or the SQL should be
 changed; preferably the SQL in order to be backwards compatible with
 drafts already existing in this format.

 (Bug reported on behalf of an estimated 450,000 Scribefire users, many of
 whom use Wordpress.)

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


More information about the wp-trac mailing list