Skip to content

Instantly share code, notes, and snippets.

@yuriitaran
Created November 26, 2018 16:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuriitaran/9813f0d7413764fcb6925a07531ae501 to your computer and use it in GitHub Desktop.
Save yuriitaran/9813f0d7413764fcb6925a07531ae501 to your computer and use it in GitHub Desktop.
WP: Remove 100 post limit for RESR API
add_filter( 'rest_endpoints', function( $endpoints ){
if ( ! isset( $endpoints['/wp/v2/posts'] ) ) {
return $endpoints;
}
unset( $endpoints['/wp/v2/posts'][0]['args']['per_page']['maximum'] );
return $endpoints;
});
//
add_filter( 'rest_endpoints', function( $endpoints ){
if ( ! isset( $endpoints['/wp/v2/posts'] ) ) {
return $endpoints;
}
$endpoints['/wp/v2/posts'][0]['args']['per_page']['default'] = 100;
return $endpoints;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment