Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#8003 closed defect (bug) (fixed)

XML-RPC call to getRecentPosts does not return drafts in order

Reported by: cfinke Owned by:
Milestone: 2.7 Priority: high
Severity: major Version:
Component: XML-RPC Keywords:
Focuses: Cc:


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.)

Change History (1)

#1 @ryan
10 years ago

  • Milestone changed from 2.8 to 2.7
  • Resolution set to fixed
  • Status changed from new to closed

Fixed in #5698

Note: See TracTickets for help on using tickets.