Don't show deleted Pages in wp.getPages results, props ryan, props Denis-de-Bernardy,fixes #11243
git-svn-id: http://svn.automattic.com/wordpress/trunk@12303 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
31bc813a6d
commit
37bcca4492
|
@ -2108,20 +2108,25 @@ class WP_Query {
|
||||||
$q_status = explode(',', $q['post_status']);
|
$q_status = explode(',', $q['post_status']);
|
||||||
$r_status = array();
|
$r_status = array();
|
||||||
$p_status = array();
|
$p_status = array();
|
||||||
if ( in_array( 'draft' , $q_status ) )
|
if ( $q['post_status'] == 'any' ) {
|
||||||
$r_status[] = "$wpdb->posts.post_status = 'draft'";
|
// @todo Use register_post_status() data to determine which states should be excluded.
|
||||||
if ( in_array( 'pending', $q_status ) )
|
$r_status[] = "$wpdb->posts.post_status <> 'trash'";
|
||||||
$r_status[] = "$wpdb->posts.post_status = 'pending'";
|
} else {
|
||||||
if ( in_array( 'future' , $q_status ) )
|
if ( in_array( 'draft' , $q_status ) )
|
||||||
$r_status[] = "$wpdb->posts.post_status = 'future'";
|
$r_status[] = "$wpdb->posts.post_status = 'draft'";
|
||||||
if ( in_array( 'inherit' , $q_status ) )
|
if ( in_array( 'pending', $q_status ) )
|
||||||
$r_status[] = "$wpdb->posts.post_status = 'inherit'";
|
$r_status[] = "$wpdb->posts.post_status = 'pending'";
|
||||||
if ( in_array( 'private', $q_status ) )
|
if ( in_array( 'future' , $q_status ) )
|
||||||
$p_status[] = "$wpdb->posts.post_status = 'private'";
|
$r_status[] = "$wpdb->posts.post_status = 'future'";
|
||||||
if ( in_array( 'publish', $q_status ) )
|
if ( in_array( 'inherit' , $q_status ) )
|
||||||
$r_status[] = "$wpdb->posts.post_status = 'publish'";
|
$r_status[] = "$wpdb->posts.post_status = 'inherit'";
|
||||||
if ( in_array( 'trash', $q_status ) )
|
if ( in_array( 'private', $q_status ) )
|
||||||
$r_status[] = "$wpdb->posts.post_status = 'trash'";
|
$p_status[] = "$wpdb->posts.post_status = 'private'";
|
||||||
|
if ( in_array( 'publish', $q_status ) )
|
||||||
|
$r_status[] = "$wpdb->posts.post_status = 'publish'";
|
||||||
|
if ( in_array( 'trash', $q_status ) )
|
||||||
|
$r_status[] = "$wpdb->posts.post_status = 'trash'";
|
||||||
|
}
|
||||||
|
|
||||||
if ( empty($q['perm'] ) || 'readable' != $q['perm'] ) {
|
if ( empty($q['perm'] ) || 'readable' != $q['perm'] ) {
|
||||||
$r_status = array_merge($r_status, $p_status);
|
$r_status = array_merge($r_status, $p_status);
|
||||||
|
|
|
@ -612,7 +612,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||||
|
|
||||||
do_action('xmlrpc_call', 'wp.getPages');
|
do_action('xmlrpc_call', 'wp.getPages');
|
||||||
|
|
||||||
$pages = get_posts( array('post_type' => 'page', 'post_status' => 'all', 'numberposts' => $num_pages) );
|
$pages = get_posts( array('post_type' => 'page', 'post_status' => 'any', 'numberposts' => $num_pages) );
|
||||||
$num_pages = count($pages);
|
$num_pages = count($pages);
|
||||||
|
|
||||||
// If we have pages, put together their info.
|
// If we have pages, put together their info.
|
||||||
|
|
Loading…
Reference in New Issue