Q:

Use method to grab metadata and return as array

I have the below method that I want to retrieve some details from the database and return them inside my method:
Here is the get_method that I have:
public function get_authors()
    {

        // @todo: Return an array of profile objects
        // @todo: This should turn an array of profiles

        $profiles = get_post_meta(get_the_ID(),'author', true);
        var_dump($profiles);

        return $profiles;
}

Here is what $profiles var_dump's:

That is linked in my database as such 'author':

Inside my wp_posts, those two ID's are linked to posts - How would I go about extracting those posts inside my method?

A:

public function get_authors()
    {

        // @todo: Return an array of profile objects
        // @todo: This should turn an array of profiles

        $profiles = get_post_meta(get_the_ID(),'author', true);

        $final_array = array(); 

        foreach($profiles as $profile){
           $final_array[$profile] = get_posts([
              'author'    =>  $profile, 
              'orderby'       =>  'date',
              'order'         =>  'DESC' 
           ]);

        }
        return $final_array;
}

Here you go, this would simply loop over the author, and get the posts of each author.

