I read all the WordPress WP rest api document but i did not find how to limit the numbers of comments i want.
I tryed. http://mywebsite.com/wp-json/posts/999/comments?filter[comments_per_page]=1
1 comment
Comments are closed.
I read all the WordPress WP rest api document but i did not find how to limit the numbers of comments i want.
I tryed. http://mywebsite.com/wp-json/posts/999/comments?filter[comments_per_page]=1
Comments are closed.
If you’re able to use version 2 of the Rest API, then the endpoint is something like the following:
where the
post
parameter is the ID of the post for which you’re retrieving the comments andper_page
is how many to show. If you want a list of all comments, and limit them, then:You can also append a page parameter to show a different paged value of comments thus:
which would return the 5th and 6th comments (page 3 of comments when there are 2 per page) for the post with an ID of 1