Skip to main content
2 of 2
deleted 54 characters in body
fcb1900
  • 101
  • 3

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);
fcb1900
  • 101
  • 3