Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Q: Create query params dynamically? #499

Open
tiptronic opened this issue Jan 17, 2022 · 1 comment
Open

Q: Create query params dynamically? #499

tiptronic opened this issue Jan 17, 2022 · 1 comment

Comments

@tiptronic
Copy link

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' ) })

@tiptronic
Copy link
Author

tiptronic commented Jan 17, 2022

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 🙄)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant