admin管理员组文章数量:1435858
I was using the below API to fetch all posts
/?filter[posts_per_page]=-1
Since the last two days, all of a sudden it stopped working.
For example, the first API used to give me 37 records with 10 records per page, but now it only gives me 10 records instead of 37. It does not return records for rest of the pages. I checked the WordPress site from where I am trying to fetch it, it still has 4 pages and 37 records.
Does anyone has any update if WordPress has changed the API? Below is the path for the API:
/
I was using the below API to fetch all posts
http://example.com/wp-json/wp/v2/posts/?filter[posts_per_page]=-1
Since the last two days, all of a sudden it stopped working.
For example, the first API used to give me 37 records with 10 records per page, but now it only gives me 10 records instead of 37. It does not return records for rest of the pages. I checked the WordPress site from where I am trying to fetch it, it still has 4 pages and 37 records.
Does anyone has any update if WordPress has changed the API? Below is the path for the API:
http://v2.wp-api.org/reference/posts/
Share Improve this question edited Oct 6, 2016 at 21:51 Ethan Rævan 4,0295 gold badges27 silver badges55 bronze badges asked Oct 6, 2016 at 21:32 Srikant BehraSrikant Behra 511 silver badge3 bronze badges 1- Possible duplicate of WP API to fetch all the media/posts records if count is more than 100 – r_alex_hall Commented Feb 9, 2017 at 7:07
1 Answer
Reset to default 1They have modified this filter in the latest 2.0 Beta 14.0 release.
The behavior with the value -1
you're familiar with was in fact a bug.
You should define new parameters in your request.
This link should be interesting: https://github.com/WP-API/WP-API/issues/2357
本文标签: wp apiWP API to fetch all records for postsmediacategories
版权声明:本文标题:wp api - WP API to fetch all records for posts, media, categories 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736622365a1945603.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论