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.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.