node-wpapi
node-wpapi copied to clipboard
Q: Create query params dynamically?
Is there a way to create query-parameters dynamically/programmatically? E.g. by adding multiple
e.g instead:
posts().param('per_page', 99)
using an array:
posts().param(['per_page', 99],['author', 5])
or an object:
posts().param({ per_page: 99, author: 5, before: new Date( '2016-09-22' ) })
Answer to self:
Just use this:
wp.posts().param({ per_page: 99, author: 5, before: new Date( '2016-09-22' ) })
(and next time, please read the code before asking 🙄)