• Greetings,

    At some point — perhaps after the upgrade to wp 3.0.1 — my get_page_index calls via JSON API began returning only the first five pages. Has anyone else experienced this? (Is there a workaround?)

    Thanks,
    Nick

Viewing 4 replies - 1 through 4 (of 4 total)
  • yes same thing is happening with mine. i’m currently digging through the code to see if i can figure out where the limitation is. it appears to be in introspector.php but that has a global $post variable and uses a method i have yet to find called have_posts() so i’ll continue to dig. if i manage to find a hacked fix… i will post… but i would hope the author can shed some real light on this versus a user’s terrible hack 🙂

    so i did find a hack workaround for this.

    in this file: wp-content/plugins/json-api/controllers/core.php

    around line: 231, in the array arguments, you want to add this:

    ‘numberposts’ => ’10’

    so mine now looks like:

    $wp_posts = get_posts(array(
      'post_type' => 'page',
      'post_parent' => 0,
      'order' => 'ASC',
      'orderby' => 'menu_order',
      'numberposts' => '10'
    ));

    i suppose i could make this a little better by using doing:

    extract($json_api->query->get('number'));

    so you could then do:

    'numberofposts' => $number

    and you just simply pass the number of pages you want returned.

    again, not great… i just wish for posts of type ‘page’ would just return them all based on their published status. i may continue to look into that.

    Plugin Author dphiffer

    (@dphiffer)

    Thanks guys, this will be fixed in the next release!

    Plugin Author dphiffer

    (@dphiffer)

    And sorry for the very slow response…

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: JSON API] get_page_index returns only five pages’ is closed to new replies.