From 73a9c335db6ab583ca3636e431740d1c72495ff2 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Fri, 2 Dec 2016 16:18:43 +0000 Subject: [PATCH] Customize: Fix posts limit query arg for `WP_Query` from incorrect `number` to `posts_per_page`. Merges [39434] onto 4.7 branch. Props dlh. Fixes #39022 for 4.7. git-svn-id: https://develop.svn.wordpress.org/branches/4.7@39435 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-wp-customize-manager.php | 6 +++--- tests/phpunit/tests/customize/manager.php | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/wp-includes/class-wp-customize-manager.php b/src/wp-includes/class-wp-customize-manager.php index 94150d64b3..4278dbd62e 100644 --- a/src/wp-includes/class-wp-customize-manager.php +++ b/src/wp-includes/class-wp-customize-manager.php @@ -794,7 +794,7 @@ final class WP_Customize_Manager { 'post_type' => 'customize_changeset', 'post_status' => get_post_stati(), 'name' => $uuid, - 'number' => 1, + 'posts_per_page' => 1, 'no_found_rows' => true, 'cache_results' => true, 'update_post_meta_cache' => false, @@ -1003,7 +1003,7 @@ final class WP_Customize_Manager { 'post__in' => $starter_content_auto_draft_post_ids, 'post_status' => 'auto-draft', 'post_type' => 'any', - 'number' => -1, + 'posts_per_page' => -1, ) ); foreach ( $existing_posts_query->posts as $existing_post ) { $existing_starter_content_posts[ $existing_post->post_type . ':' . $existing_post->post_name ] = $existing_post; @@ -1016,7 +1016,7 @@ final class WP_Customize_Manager { 'post_name__in' => $all_post_slugs, 'post_status' => array_diff( get_post_stati(), array( 'auto-draft' ) ), 'post_type' => 'any', - 'number' => -1, + 'posts_per_page' => -1, ) ); foreach ( $existing_posts_query->posts as $existing_post ) { $key = $existing_post->post_type . ':' . $existing_post->post_name; diff --git a/tests/phpunit/tests/customize/manager.php b/tests/phpunit/tests/customize/manager.php index c179026b87..345e666b36 100644 --- a/tests/phpunit/tests/customize/manager.php +++ b/tests/phpunit/tests/customize/manager.php @@ -402,6 +402,7 @@ class Tests_WP_Customize_Manager extends WP_UnitTestCase { ), ); + update_option( 'posts_per_page', 1 ); // To check #39022. add_theme_support( 'starter-content', $starter_content_config ); $this->assertEmpty( $wp_customize->unsanitized_post_values() ); $wp_customize->import_theme_starter_content();