custom-metadata
custom-metadata copied to clipboard
How can I update cloneable field values?
Hello,
I'm having an issue with trying to update the values of a cloneable field, for instance,
Retrieving the value as follows
$emails = get_post_meta(123, 'memo_category-103');
print_r($emails);
as you'd expect returns
Array ( [0] => [email protected] [1] => [email protected] )
I can array push to add a new value:
array_push($emails, '[email protected]');
Array ( [0] => [email protected] [1] => [email protected] [2] => [email protected] );
But when I save it for example
$emails = array('[email protected]', '[email protected]', ' [email protected]');
update_post_meta(123, 'memo_category-103', $emails);
I get this
Array ( [0] => Array ( [0] => [email protected] [1] => [email protected] [2] => [email protected] ) [1] => Array ( [0] => [email protected] [1] => [email protected] [2] => [email protected] ) )
I've tried several different ways to try and rectify this but it doesn't work, I would love to switch to a different meta field plugin but unfortunately, I can't as there are thousands of posts stored using this so I'm having to try my best to rectify it, any help would be greatly appreciated.
Or if anyone else has a solution it too would be greatly appreciated.