Get all post meta

/* Get All Post Meta */
function wco_get_all_post_meta($post_id){
global $wpdb;
$results = array();
$wpdb->query("
SELECT `meta_key`, `meta_value`
FROM $wpdb->postmeta
WHERE `post_id` = $post_id
");
foreach($wpdb->last_result as $key => $value){ $results[$value->meta_key] = $value->meta_value; }
return $results;
}

0 Comments

You must be logged in to post a comment.