• Hi,

    I am using JSON_API plugin version 1.0.7. I created my own plugin which:
    * inserts own category with some subterms,
    * creates a custom type to which newly created category is registered with
    * defines a controller as an extension to JSON API

    The bug I found is appearing when I use JSON API inspector to perform consecutive queries with different arguments in my custom controller. Every result set is equal to the first.

    My controller method code:

    public function get_article_list() {
    global $json_api;

    $args = array(
    'post_type' => 'article',
    'post_status' => 'publish',
    'taxonomy' => 'category',
    'term' => 'red-wine'
    );
    $nb_reds = count( $json_api->introspector->get_posts( $args) );

    $args['term'] = 'rose-wine';
    $nb_roses = count( $json_api->introspector->get_posts( $args) );

    $args['term'] = 'white-wine';
    $nb_whites = count( $json_api->introspector->get_posts( $args) );

    var_dump($nb_reds, $nb_roses, $nb_whites);
    }

    The fix I suggest is to reverse the array_merge arguments order in ./singletons/inspector.php line 278, to get:

    $query = array_merge($wp_query->query, $query);

    http://wordpress.org/extend/plugins/json-api/

  • The topic ‘[Plugin: JSON API] inspector bug when consecutive queries with different arguments’ is closed to new replies.