Last active
July 28, 2016 19:27
-
-
Save romuloctba/9a09554a58f56a05444c85b68e7f78e3 to your computer and use it in GitHub Desktop.
Sort WP-API posts by custom field
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function addsomevars($filters){ | |
$metaparts = array("meta_key", "meta_value", "meta_compare", "meta_query"); | |
$filters = array_merge($filters, $metaparts); | |
return $filters; | |
} | |
add_filter('json_query_vars', 'addsomvars'); | |
// url.com/wp-json/posts?filter[meta_key]=app-use&filter&filter[meta_value]=yes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment