#39022 closed defect (bug) (fixed)
Invalid query parameters in `WP_Customize_Manager`
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 4.7 | Priority: | normal |
| Severity: | normal | Version: | 4.7 |
| Component: | Customize | Keywords: | has-patch commit has-unit-tests dev-reviewed |
| Focuses: | Cc: |
Description
WP_Customize_Manager passes the number parameter to some WP_Query instances, but, as far as I can tell, WP_Query doesn't accept number.
For instance, in trunk running Twenty Seventeen, after this query: https://core.trac.wordpress.org/browser/trunk/src/wp-includes/class-wp-customize-manager.php#L1015
The value of $existing_posts_query->request is: "SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 AND wp_posts.post_name IN [...] ORDER BY wp_posts.post_date DESC LIMIT 0, 10"
I assume the LIMIT wasn't supposed to be there, so the attached patch would replace number with posts_per_page.
Attachments (2)
Change History (8)
#1
@
9 years ago
- Milestone changed from Awaiting Review to 4.7
- Owner set to westonruter
- Status changed from new to accepted
#2
@
9 years ago
- Keywords has-patch commit dev-feedback added
@dlh wow, good catch! You're right.
PSA: get_pages() takes number, get_posts() has the alias numberposts, and WP_Query takes posts_per_page.
Tweak starter content unit test to ensure fix works