I'm a little new to Wordpress and the JSON API so forgive me if this is a newbie question but i'm trying to get all of the posts of a few different custom post types and return them as JSON via my own JSON controller (extending the JSON API)

if I do this:

$posts = $json_api->introspector->get_posts(array('post_type' => array('post','tweet','gallery','video','music'), 'post_parent' => 0, 'order' => 'ASC', 'orderby' => 'date', 'numberposts' => 100000000000));
echo count($posts);

I only get "10" posts but there are a lot more in the db. Whereas if I do this:

echo count(get_posts(array('post_type' => array('post','tweet','gallery','video','music'), 'post_parent' => 0, 'order' => 'ASC', 'orderby' => 'date', 'numberposts' => 100000000000)));

I get "74", the correct number of posts in the db. Essentially the JSON API is limiting the returned value to only 10 posts. I'm pretty sure I can hack the JSON API plugin to allow more but that seems like it would mess up my code for any API upgrades.

Is there a way to set the JSONAPI->introspector post number to "all"


[Mods: I have cross posted this in stack overflow a minute ago but wasn't sure which site would be better to post this question please let me know and I'll remove as appropriate]


I'm answering my own question because it might be useful to someone else sometime.

After reading through the somewhat sparse documentation on the wordpress plugin directory and getting nowhere. I found a variable in the JSON API code here's how it works PS -1 just mean "all":

$posts = $json_api->introspector->get_posts(array('post_type' => array('post','tweet','gallery','video','music'), 'post_parent' => 0, 'order' => 'ASC', 'orderby' => 'date', 'numberposts' => 4));
echo count($posts);

you can set the count to whatever you want before making the api call.


This will remove limit from child post requests

  1. Open file singletons/introspector.php within JSON Api plugin folder.
  2. add 'showposts' => -1 after 'orderby' => 'menu_order'
  • A link to another support request? Honestly? – kaiser Nov 23 '12 at 15:47

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.