2

I'm using the rest API to get only selected posts though Rest API. I have used include=<ids> parameter.

I have send the API request like:

http://example.com/wp-json/wp/v2/posts?include=11,12

It works as expected. But, What happen If there are 200+ post IDs.

The request like:

http://example.com/wp-json/wp/v2/posts?include=11,12,...,200

What is the max limit for include parameter? I have used the POST method to get the posts.

  • Are you trying to get all posts or just specific ones? if you want all posts then remove the ?include... part and just end the call at /posts – Robbiegod Jun 5 '18 at 20:32
  • Nope, I'm want a specific posts. For that I have used include. I think I need to send more request (100 each) to get all the posts. It'll be helpful. – maheshwaghmare Jun 6 '18 at 4:39
  • 1
    In a handbook the include parameter is not listed. I have used it to get the group of posts by ids. Check this example nprdpinc.org/wp-json/wp/v2/posts?include=200,3477 you'll get only 2 posts. I'll categorize the posts but, The reasons of include parameter is, I have import the posts with rest API and once imported the id of that post is stored in the option table. So, I have showing the imported posts to user with the help of stored post ids and using include parameter in the rest api. – maheshwaghmare Jun 12 '18 at 4:31
  • 1
    I have check the Rest API class and found that the parameter include is mapping parameter of post__in. You can see here other mapping parameters. core.trac.wordpress.org/browser/tags/4.9/src/wp-includes/… – maheshwaghmare Jun 12 '18 at 4:44
  • 1
    I have created the article of all possible query parameter mappings - maheshwaghmare.wordpress.com/2018/06/12/… – maheshwaghmare Jun 12 '18 at 5:00

Your Answer

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

Browse other questions tagged or ask your own question.