最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

wp api - WP API to fetch all records for posts, media, categories

programmeradmin17浏览0评论

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
Add a comment  | 

1 Answer 1

Reset to default 1

They 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

发布评论

评论列表(0)

  1. 暂无评论