Filter
rpress_api_results_per_page
On this page
Filters the number of results returned per page by the API.
Runs when the API reads the number query variable, which defaults to 10. For the customers mode a negative number is replaced with a very large value. Return a different integer to cap or change the page size.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$per_page | int | Number of results per page. |
Return value#
int. The number of results per page.
Example#
function my_api_results_per_page( $per_page ) {
return min( (int) $per_page, 100 );
}
add_filter( 'rpress_api_results_per_page', 'my_api_results_per_page' );
Source#
Applied in:
includes/api/class-rpress-api.php(line 577), inRPRESS_API::per_page()includes/class-rpress-api.php(line 371), inRPRESS_API::per_page()
See also#
Was this page helpful?
