WP-API/WP-API — pull request #118 by iandunn (2014-03-14 21:33:52+00:00)
Title: Pass get_posts() parameters to json_query_var callbacks.

I think it'd be useful if the `json_query_var` filters passed the `get_posts()` parameters to their callbacks. My use case for this is wanting to allow users to query for a custom post type via certain post meta fields. e.g.:

`http://example.org/wp-json.php/posts/?type=my_cpt&filter[meta_key]=Location&filter[meta_value]=Seattle`

So my CPT would have a callback like this:

```
add_filter( 'json_query_vars', array( $this, 'register_json_query_vars' ), 10, 5 );
function register_json_query_vars( $query_vars, $filter, $context, $type, $page ) {
$public_meta_keys = array( 'Location' );

if ( 'my_cpt' == $type && ! empty( $filter['meta_key'] ) && in_array( $filter['meta_key'], $public_meta_keys ) ) {
$query_vars[] = 'meta_key';
$query_vars[] = 'meta_value';
}

return $query_vars;
}
```