Sunday, 2 June 2013

Get user_meta values for a user for an array of meta_keys?

Get user_meta values for a user for an array of meta_keys?

I would like to retrieve the meta_values for an array of meta_keys for a user. Is there a function in WordPress core that offers this functionality? Something that would work like this:
$array_of_keys = array( 'key_1', 'another_key' );

$values = get_user_meta_array( $user_id, $array_of_keys );
And values would maybe be an array like this:
array(
    'key_1'       => 'some value',
    'another_key' => 5,
);
I could easily write a custom function to do this, but I would rather do it 'the WordPress way' if there is one.
Thanks.

No comments:

Post a Comment