node-wpapi icon indicating copy to clipboard operation
node-wpapi copied to clipboard

Filter is not a function

Open el-lsan opened this issue 8 years ago • 2 comments

I have already installed rest-filter plugin, as well as including the configuration object when I'm registering the route:

wpapi.magazines = wpapi.registerRoute('wp/v2', '/magazines', {
  params: [ 'filter ']
});

But I still get filter is not a function error, when I'm trying to filter the result by a custom field:

wpapi.magazines().filter('is_top', true)

Do I miss something here ?

el-lsan avatar Dec 04 '17 12:12 el-lsan

There is a typo, trim the filter param, there is a space at the end ;)

Fabiencdp avatar Apr 05 '19 10:04 Fabiencdp

I think @Fabiencdp's comment is correct, you're registering the param 'filter ' with an extra space. I'll leave this open for now however to consider adding a .trim() call to the logic which matches params to handlers.

kadamwhite avatar Oct 21 '19 21:10 kadamwhite