How should this work / get_post_meta
-
Recently (https://core.trac.www.ads-software.com/changeset/19908), the get_post_meta function was changed to work with just a post ID as a parameter, so that it can be called like this:
$data = get_post_meta($post_id)
However, I noticed that it returns every value as an array (so more like get_post_custom). I tried the following:
$event_meta = get_post_meta( $e->ID , '', true);
I was expecting that it would return all of my custom fields as single strings, since I’m passing a $single parameter.
It doesn’t quite work that way, though – it’s still returning each field as an array.
Looking at the core code, I can understand why, but I’m wondering if this feature would be useful to others as it is to me.
- The topic ‘How should this work / get_post_meta’ is closed to new replies.