[wp-trac] [WordPress Trac] #43998: REST API: Permit unbounded per_page=-1 requests for authorized users

WordPress Trac noreply at wordpress.org
Fri May 11 11:49:46 UTC 2018


#43998: REST API: Permit unbounded per_page=-1 requests for authorized users
------------------------------------------+-----------------------
 Reporter:  danielbachhuber               |       Owner:  (none)
     Type:  enhancement                   |      Status:  new
 Priority:  normal                        |   Milestone:  4.9.7
Component:  REST API                      |     Version:
 Severity:  normal                        |  Resolution:
 Keywords:  needs-patch needs-unit-tests  |     Focuses:  rest-api
------------------------------------------+-----------------------

Comment (by danielbachhuber):

 Worth noting: there's a bug in `WP_REST_Posts_Controller` right now where
 passing `posts_per_page=-1` will falsely error on:

 {{{
 $max_pages = ceil( $total_posts / (int)
 $posts_query->query_vars['posts_per_page'] );
 if ( $page > $max_pages && $total_posts > 0 ) {
         return new WP_Error( 'rest_post_invalid_page_number', __( 'The
 page number requested is larger than the number of pages available.' ),
 array( 'status' => 400 ) );
 }
 }}}

 This issue will need to be addressed too.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/43998#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list