[wp-trac] [WordPress Trac] #42687: get_post_meta() is returning arrays even when the $single value is true
WordPress Trac
noreply at wordpress.org
Sat Nov 25 05:35:41 UTC 2017
#42687: get_post_meta() is returning arrays even when the $single value is true
---------------------------------------------------+------------------
Reporter: titodevera | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 5.0
Component: Posts, Post Types | Version: 4.9
Severity: normal | Resolution:
Keywords: needs-patch needs-docs good-first-bug | Focuses:
---------------------------------------------------+------------------
Changes (by dd32):
* keywords: reporter-feedback => needs-patch needs-docs good-first-bug
* milestone: Awaiting Review => 5.0
Comment:
Replying to [comment:2 titodevera]:
> The error only occurs when i retrieve all post meta data from a post,
it's working well when I specify a meta_key as in your example (second
get_post_meta() param)
My apologies! I missed that.
In that case, It's intentional, and it looks like the documentation needs
updating. The function is a wrapper for
[https://developer.wordpress.org/reference/functions/get_metadata/
get_metadata()] which does correctly document it.
If someone wants to whip up a patch to update the function docs here
that'd be great :)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/42687#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list