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

wp post list: Add JSON input support for date_query argument #520

Conversation

sabithahmd
Copy link

Added Utils\parse_shell_arrays for list in post command which will convert argument values from json to array before passing to the query. currently only date_query is added to the list of arguments to be considered for the conversion.
It can be used as wp post list --date_query='{"before":{"year":"2025"}}'
this fixes #519

Thank you @swissspidy for suggesting this solution.

@sabithahmd sabithahmd requested a review from a team as a code owner February 17, 2025 13:50
@swissspidy
Copy link
Member

Thanks for your contribution!

Would you be able to help with adding tests for this change? Besides written documentation we also have an introductory video about writing tests.

@swissspidy swissspidy changed the title fixed date_query argument not working for post list command wp post list: Add JSON input support for date_query argument Feb 18, 2025
@swissspidy swissspidy added this to the 2.8.3 milestone Feb 18, 2025
@swissspidy swissspidy merged commit 56553b8 into wp-cli:main Feb 18, 2025
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support WP_Query's date_query values from wp post list command-line
3 participants