PHP – WordPress – Get all Post Meta

The given PHP funciton returns all of a WordPress post meta data in an array without specifying 
a key.

Code Example:

function get_post_meta_all($post_id){
	global $wpdb;
	$data = array();
	SELECT `meta_key`, `meta_value`
	FROM $wpdb->postmeta
	WHERE `post_id` = $post_id
	foreach($wpdb->last_result as $k => $v){
		$data[$v->meta_key] = $v->meta_value;
	return $data;

Post to Twitter Post to Digg Post to Facebook Post to Google Buzz Send Gmail