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

Support non unique meta_keys when getting values #325

Open
1 task done
grappler opened this issue Aug 5, 2021 · 2 comments
Open
1 task done

Support non unique meta_keys when getting values #325

grappler opened this issue Aug 5, 2021 · 2 comments

Comments

@grappler
Copy link

grappler commented Aug 5, 2021

Feature Request

Describe your use case and the problem you are facing

Post meta can either be unique or non single. This means that the same meta key can be used multiple times in post meta. When using get_post_meta() you can pass if the meta key is single or not.

Unfortunately wp post meta 1 meta_key does not support this. At the moment only the first value is returned.

Describe the solution you'd like

This is caused by the fixed defined parameter in the code:

$value = $this->get_metadata( $object_id, $meta_key, true );

It would be nice if the third parameter could be either set using the arguments or using a flag. Either
wp post meta 1 meta_key false or wp post meta 1 meta_key --is-single=false.

@danielbachhuber
Copy link
Member

I'm open to a pull request for this. I don't have any great ideas on what the default format should be, though

#142 should probably be considered in tandem.

@imrraaj
Copy link

imrraaj commented Jun 25, 2024

Hii @danielbachhuber I would like to work on this issue. I think adding a extra flag seems reasonable for this. Default should be false and we show multiple values if we find them.

Your thoughts?

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

No branches or pull requests

3 participants