Increase per_page limit in REST API

The collection params accessed via that filter appear to describe the available query params but are not actually used in the query.

I think what you actually want is the rest_{$this->post_type}_query filter which allows you to modify the args before they are passed to WP_Query::query().

Also keep in mind that on the API request the per_page arg might be set, but internally that is translated to posts_per_page for the actual query args.

Edit: I think I misread the original question…

The rest_{$this->post_type}_collection_params does indeed describe the available params.

You should be able to set the per_page max at $params['per_page']['maximum'].

Leave a Comment