public function get_loaded_meta( $key )
This method allows you to quickly retrieve post meta loaded using the load_meta() method, which must first be called for this method to function correctly. If the loaded meta key doesn't exist, or is empty, this method returns false. If the loaded meta key you wish to retrive is an array, use the get_serialized_loaded_meta() method instead, as this method will not unserialize retrieved meta values.
(string) (required) The meta key to pull from the $meta property (where all meta for the current post is stored)
Take the following code:
In the above code, we first retrieve an array of recent post IDs using the WordPress' get_posts() funtion. Then, we loop through the array, calling the load_meta() method at the start of each pass through to load the current post's post meta into the $loaded_meta property. Then, we use the get_loaded_meta() method to see if an array key exists and isn't empty. Specifically, the method checks to see if
$loaded_meta['_mytheme_intro_img_id'] exists and has a value. If so, we use the method again to pass an attachment ID to the wp_get_attachment_image() function, adding the resulting image to the layout's html output. This is commonly done with in conjunction with CMB2 file fields, used to let content editors pick imagery using custom editor options.