Skip to content

Instantly share code, notes, and snippets.

@circlecube
Created December 29, 2016 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save circlecube/cd8a1a3d8eabe3307bd5bb887bbb1868 to your computer and use it in GitHub Desktop.
Save circlecube/cd8a1a3d8eabe3307bd5bb887bbb1868 to your computer and use it in GitHub Desktop.
WillyMelt API Tweaks
// add custom fields query to WP REST API v2
// https://1fix.io/blog/2015/07/20/query-vars-wp-api/
function my_allow_meta_query( $valid_vars ) {
$valid_vars = array_merge( $valid_vars, array( 'meta_key', 'meta_value' ) );
return $valid_vars;
}
add_filter( 'rest_query_vars', 'my_allow_meta_query' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment