WP_User_Query should support -1 for the number parameter
|Reported by:||mordauk||Owned by:||wonderboymusic|
In order to be consistent with WP_Query, I think WP_User_Query should accept -1 as a valid value for the number parameter.
If you want to perform a query that returns all posts, you pass -1 for posts_per_page to WP_Query.
If you try to do this with WP_User_Query, however, you get an SQL syntax error:
WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1' at line 2] SELECT SQL_CALC_FOUND_ROWS wp_users.* FROM wp_users INNER JOIN wp_usermeta ON (wp_users.ID = wp_usermeta.user_id) WHERE 1=1 AND ( (CAST(wp_usermeta.meta_value AS CHAR) LIKE '%\"pending\\_vendor\"%') ) AND (wp_usermeta.meta_key = 'wp_capabilities' ) ORDER BY user_login ASC LIMIT -1
LIMIT can't be -1 in SQL.
I'd expect both of these to return the same results:
$query = new WP_User_Query( array( 'number' => -1 ) ); $query = new WP_User_Query( array( 'number' => 99999999 ) );
Change History (17)
- Keywords needs-unit-tests added
- Milestone changed from Awaiting Review to Future Release
- Keywords needs-testing removed
- Milestone changed from Future Release to 4.4
- Owner set to wonderboymusic
- Resolution set to fixed
- Status changed from new to closed