WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#11123 closed defect (bug) (fixed)

Limit wp_get_recent_posts() to real/live posts

Reported by: josephscott Owned by:
Milestone: 2.9 Priority: normal
Severity: normal Version: 2.9
Component: Trash Keywords: has-patch
Focuses: Cc:

Description

The WP function wp_get_recent_posts does a simple SELECT against the posts table to get data on recent posts. This function is currently only used by the mw_getRecentPosts() function (XML-RPC method metaWeblog.getRecentPosts) to provide clients with a list of recent WP posts.

A check for post_status needs to be added so that wp_get_recent_posts only returns data for "real" posts, ones with a post_status of 'draft', 'publish', 'future', 'pending', or 'private'.

With out this metaWeblog.getRecentPosts will return data for posts that have been deleted when trash is turned on.

Attachments (1)

wp-includes--post.php.diff (582 bytes) - added by josephscott 4 years ago.

Download all attachments as: .zip

Change History (3)

comment:1 ryan4 years ago

  • Component changed from General to Trash

comment:2 azaozz4 years ago

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

(In [12237]) Limit wp_get_recent_posts() to real/live posts, props josephscott, fixes #11123

Note: See TracTickets for help on using tickets.