WordPress.org

Ready to get started?Download WordPress

Forums

JSON API
get_page_index returns only five pages (5 posts)

  1. npavkovic
    Member
    Posted 3 years ago #

    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

  2. blinder
    Member
    Posted 3 years ago #

    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 :)

  3. blinder
    Member
    Posted 3 years ago #

    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.

  4. dphiffer
    Member
    Plugin Author

    Posted 3 years ago #

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

  5. dphiffer
    Member
    Plugin Author

    Posted 3 years ago #

    And sorry for the very slow response...

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags