Support

Account

Home Forums General Issues Want to use get_post_meta instead of get_field for array Reply To: Want to use get_post_meta instead of get_field for array

  • I think this is what you’ll want to do:

    $myvalues = unserialize( get_post_meta($post->ID,'my_key') );
    
    foreach ($myvalues as $myvalue) { 
        echo $myvalue .', '; 
    }

    The value a:4:{i:0;s:7:”value_1″;i:1;s:7:”value_2″;i:2;s:7:”value_3″;i:3;s:7:”value_4″;} that you returning is just a serialized or stringified version of the php array that you want to loop through.