I am building a custom solution where I am needing to obtain all the meta values for a post into an array. I have many “keys”. Is there a way to loop through them all without doing this? I have the post ID at this point in my script.
$image_meta = get_post_meta( $post->ID, 'image', true );
// car year
$car_year = get_post_meta( $post->ID, 'car_year', true );
// car mileage
$car_mileage = get_post_meta( $post->ID, 'car_mileage', true );
// car price
$car_price = get_post_meta( $post->ID, 'car_price', true );
// car model
$car_model = get_post_meta( $post->ID, 'car_model', true );