Skip to content

Commit

Permalink
Quick attempt at making info available via REST-API. See issue greysc…
Browse files Browse the repository at this point in the history
  • Loading branch information
ms-studio committed Nov 12, 2016
1 parent 29876a2 commit 783ab7a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions functions/functions-init.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,23 @@ function prefix_kill_all_the_jetpacks( $modules ) {
return $modules;
}

/**
* REST API
* allow REST API to filter by custom field
* SEE: http://wordpress.stackexchange.com/questions/225850/
* and
* https://github.com/WP-API/WP-API/issues/1599
*/

add_filter('rest_query_vars', 'wpse225850_add_rest_query_vars');

function wpse225850_add_rest_query_vars($query_vars) {

$query_vars = array_merge( $query_vars, array('meta_key', 'meta_value', 'meta_compare') );

return $query_vars;

}



Expand Down

0 comments on commit 783ab7a

Please sign in to comment.