node-wpapi
node-wpapi copied to clipboard
Filter is not a function
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 ?
There is a typo, trim the filter param, there is a space at the end ;)
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.