WordPress.org

Ready to get started?Download WordPress

Forums

JSON API
Add meta query to get_post (2 posts)

  1. walming
    Member
    Posted 4 years ago #

    This plugin is just awesome!

    I needed meta query for a project so I added meta_key and meta_value to get_post method

    In file core.php I added to line 38

    extract($json_api->query->get(array('id', 'slug', 'post_id', 'post_slug', 'meta_key', 'meta_value')));

    and on line 53

    } else if ($meta_key && $meta_value) {
          $posts = $json_api->introspector->get_posts(array(
            'meta_key' => $meta_key, 'meta_value' => $meta_value
          ));

    Now you can query by meta data as

    /api/get_post/?meta_key=test&meta_value=cool

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

  2. dphiffer
    Member
    Plugin Author

    Posted 4 years ago #

    Nice! I should include something like this in a future release.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags