I got that working :) add_filter('rest_myRoute_query', function($args, $request) { $fields = array('myCustomField'); foreach ($fields as $field) { if (! empty($request[$field])) { $args['meta_query'][] = array( 'key' => $field, 'value' => esc_sql($request[$field]), ); } } return $args; }, 10, 2);