Skip to content

Commit 7a83a96

Browse files
committed
Make the number of pages argument to wp.getPages properly optional. See WordPress#10659 props redsweater.
git-svn-id: https://develop.svn.wordpress.org/trunk@11850 602fd350-edb4-49c9-b593-d223f7449a82
1 parent f55835e commit 7a83a96

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

xmlrpc.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ function wp_getPages($args) {
601601
$blog_id = (int) $args[0];
602602
$username = $args[1];
603603
$password = $args[2];
604-
$num_pages = (int) $args[3];
604+
$num_pages = isset($args[3]) ? (int) $args[3] : 10;
605605

606606
if ( !$user = $this->login($username, $password) ) {
607607
return $this->error;
@@ -612,12 +612,7 @@ function wp_getPages($args) {
612612

613613
do_action('xmlrpc_call', 'wp.getPages');
614614

615-
$page_limit = 10;
616-
if( isset( $num_pages ) ) {
617-
$page_limit = $num_pages;
618-
}
619-
620-
$pages = get_posts( array('post_type' => 'page', 'post_status' => 'all', 'numberposts' => $page_limit) );
615+
$pages = get_posts( array('post_type' => 'page', 'post_status' => 'all', 'numberposts' => $num_pages) );
621616
$num_pages = count($pages);
622617

623618
// If we have pages, put together their info.

0 commit comments

Comments
 (0)