CalderaWP / searchwp-api-route

Adds an endpoint to the WordPress REST API for searching via SearchWP
33 stars 15 forks source link

Update defaults #1

Closed JPry closed 1 year ago

JPry commented 9 years ago

Change the default value for tax_query and meta_query to null, so that the default value doesn't trigger the validation callback.

Without this change, a simple search (no tax query parameters passed) yields a response like this:

[{"code":"rest_invalid_param","message":"Invalid parameter(s): Invalid param.","data":{"status":400,"params":{"tax_query":"Invalid param."}}}]

Technically the meta_query portion is working fine as-is, but I feel that it's more appropriate to have a default of null than an array filled with empty values.

Shelob9 commented 9 years ago

@JPry Thanks for the PR, but I'm pretty sure -- can't figure out how to set up unit tests on SWP_Query -- I addressed this issue in https://github.com/CalderaWP/searchwp-api-route/commit/ee372f3f6529e8d51e4f8b475a733ad61a344a3e