1

I am trying to get the json data of my posts. I have tried with both v1.2.4 and v2 of the REST API plugin.

If I enter

http://example.com/wp-json/posts?type=magazine

or

http://example.com/wp-json/posts?type=magazine&filter[posts_per_page]=-1

just an empty array is returned.

If I enter

http://example.com/wp-json/posts?type=magazine&filter[posts_per_page]=80

(or any number between 1 and 80)

all data appear just fine.

Is there a limit? I need to get ALL the posts from any custom post type.

  • 1
    See this – Pieter Goosen Nov 15 '15 at 18:32
  • Thank you so much for your reply. It must be that the server runs out of memory then. Do you know what could I do about that? – Jeff Nov 15 '15 at 18:36
1

Try this instead for pagination. It returns all the posts on my site.

http://example.com/wp-json/wp/v2/posts/?filter[category_name]=country&filter[posts_per_page]=-1
  • As enhancement the important part filter[posts_per_page]=-1 without a filter, like /wp-json/posts?filter[posts_per_page]=-1 – bueltge Jan 17 '18 at 8:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.