Wordpress API JSON return limit

If you're using v2 of the WordPress REST API, it looks like the current method of controlling the number of results returned is:

website.com/wp-json/wp/v2/posts/?per_page=100

Replace 100 with the desired count.

If you're using a custom post type, replace posts with the custom post type. Also make sure to set 'show_in_rest' => true when configuring the custom post type.


Add the filter[posts_per_page] parameter to the query to restrict the number of results returned by the API.

http://thisismywebsitewherewordpresslives.com/wp-json/posts?filter[posts_per_page]=2&fiter[category_name]=Some Category Name I want to query&filter[order]=ASC

The above query should return only 2 results. The list of query parameters are present here https://github.com/WP-API/WP-API/blob/master/docs/routes/routes.md#retrieve-posts


As another said : (v2)

http://example.com/wp-json/wp/v2/posts?per_page=10

But If you want to get more next posts : (paged)

http://example.com/wp-json/wp/v2/posts?per_page=10&page=2

Docs : http://v2.wp-api.org/reference/posts/ (Scroll to List Posts)

Tags:

Json

Wordpress