Skip to content

Conversation

@BhargavBhandari90
Copy link
Contributor

Fixes #325

  • Currently marked as WIP.
  • I haven't wrote behat tests for this yet.
  • Let's finalize the changes first and then I'll write the tests.

What I did

  • Added a flag --is-single
  • Default value will be 1 ( true ) which was already there.
  • And we can now pass 0 as false for getting multiple values

Command Examples

  • wp post meta get 1 bwp_key --is-single=0
  • wp post meta get 1 bwp_key --is-single=1

@BhargavBhandari90 BhargavBhandari90 requested a review from a team as a code owner February 26, 2025 10:00
@swissspidy swissspidy added the command:post-meta-get Related to 'post meta get' command label Feb 26, 2025
@BhargavBhandari90
Copy link
Contributor Author

@swissspidy After your feedback, now command will be

  • wp post meta get 1 bwp_key --single // For true
  • wp post meta get 1 bwp_key --no-single // For false

And without the single flag it will work the way it was working.

@swissspidy
Copy link
Member

Sounds good! Next steps: tests.

@BhargavBhandari90
Copy link
Contributor Author

@swissspidy Yep. On it

@BhargavBhandari90 BhargavBhandari90 changed the title WIP: Add a new flag for getting post meta as a single value or not Add a new flag for getting post meta as a single value or not Feb 26, 2025
@BhargavBhandari90 BhargavBhandari90 changed the title Add a new flag for getting post meta as a single value or not Add a flag for getting post meta as a single value or not Feb 26, 2025
@swissspidy swissspidy requested review from a team and swissspidy February 26, 2025 22:40
@swissspidy swissspidy added this to the 2.8.3 milestone Feb 26, 2025
@swissspidy swissspidy merged commit 6ec0aab into wp-cli:main Feb 27, 2025
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

command:post-meta-get Related to 'post meta get' command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support non unique meta_keys when getting values

3 participants