WP API to fetch all records for /posts, /media, /categories

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/

1 Answer
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

Leave a Comment