For the project I’m working on right now, I needed to access some post meta that’s considered protected, or private. The difference between private post meta and public post meta is that private meta keys start with an underscore (i.e. _private_meta_key) and do not appear in the custom-fields meta box on post editing screens. When running the get_post_meta function and printing the key => value pairs to the screen, WordPress skips over these private meta and only prints publicly visible meta. This wasn’t working for me because I needed data stored in a private meta key.
This snippet grabs all of the meta for the current post, checks to see if the key begins with an underscore, forces the loop to continue if it does rather than skipping over it, and prints the key => value pairs to the header. For an easier way to read the data, I set a dark-gray background for the key => value pairs and a light-gray background for the values if the value is an array.