Wordpress Saving Array in native Custom Field

Ramesh Dura
1 min readMay 22, 2019

--

In Dashboard
{“A+B”:”500",”B+C”:”400",”D+E”:”250"}

In PHP File
$json = get_post_meta(get_the_ID(), “multiprice”, true);
$arr = @ json_decode($json, true);
if($arr != NULL){
foreach($arr as $key => $value){
echo $key.’ — ‘.$value.’<hr/>’;
}
}

--

--

Ramesh Dura
Ramesh Dura

Written by Ramesh Dura

Student of Literature & Web Developer

No responses yet