I have 27 items of post_meta data that I need to get out in a class that I use through-out my website.
Currently I'm using:
$this->postMetaData = get_metadata("post", $postID);
This returns an array of arrays... such as...
Array( [first_element] => Array(  => firstValue ) [second_element] => Array(  => secondValue )
I then have to 'loop' through the array and 'flatten' it down so it becomes:
Array( [first_element] => firstValue [second_element] => secondValue etc )
I then assign the array elements to variables in the class such as:
$this->firstElement = $myArray["first_element"];
As part of some micro-optimisation I was looking at I wondered if there was a better way of doing this. I've read about get_metadata and get_post_meta and wondered whether I'm better using get_post_meta (or get_metadata) as singles... for instance:
$this->firstElement = get_post_meta($postID, "first_element", true); etc
Or whether I should just use a bespoke query to get the items out of the database?
Any idea which is better?