I am using per_page instead of the filter since it is no more available. but the problem is per_page value can be between 1 and 100. what if I want to pull records and it is more that 100. per_page will not return records if the count is more than 100.
in the below API I want to pull the images which are more than 100 in count.
http://domain_name/wp-json/wp/v2/media/?per_page=100
Appreciate your help
Srikant
4 Answers
Add a page number query to your request URL, and continue querying next page numbers until you get an empty result:
<your_wordpress_install_base_url>/wp-json/wp/v2/media/?per_page=100&page=2
Mark’s suggestion to consider requesting less than 100 per page may be a good one. So for example you may want to do your query this way:
<your_wordpress_install_base_url>/wp-json/wp/v2/media/?per_page=25&page=3
Note also that (for me at least) these query URLs work if constructed as just ~/media?per_page=3
(instead of ~/media/?per_page=3
). I don’t know whether one or the other is preferred.
Thanks, incidentally, for the /media/?per_page=100
part of your example. I’d been stumped about getting empty results when querying just /media
🙂