Skip to content

Instantly share code, notes, and snippets.

@Tmeister
Last active April 4, 2017 21:04
Show Gist options
  • Save Tmeister/789ab06c63ab49f4a0cc5752ed06c68d to your computer and use it in GitHub Desktop.
Save Tmeister/789ab06c63ab49f4a0cc5752ed06c68d to your computer and use it in GitHub Desktop.
Change the Maximum per_page value in the Query
<?php
function change_end_points_default_values($endpoints){
/**
* Posts EndPoint
* print_r($endpoints['/wp/v2/posts']);
*
* Argumentos Originales
*
* Array
* (
* [description] => Maximum number of items to be returned in result set.
* [type] => integer
* [default] => 10
* [minimum] => 1
* [maximum] => 100
* [sanitize_callback] => absint
* [validate_callback] => rest_validate_request_arg
* )
*/
$endpoints['/wp/v2/posts'][0]['args']['per_page']['maximum'] = 1000;
return $endpoints;
}
add_filter('rest_endpoints', 'change_end_points_default_values');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment