Hi,
I want to put array into meta_value in wp_postmeta table, I have front-end form and I update_post_meta with get_field with repeater as a selector. In this repeater i have date_picker with name date and group with two date_pickers named newdate.
If I name group and date_picker the same I can’t get data from front-end form, so i named it differently and I wanted to override “date” with “newdate” data i tried to use have_rows() with
$sub_value = get_sub_field('newdate');
update_sub_field("date", $sub_value);
delete_sub_field('newdate');
But it doesnt work, do you have any ideas how can i update date field with newdate subfield and delete it after before i send data with post and use get_field + update_post_meta to populate wp_postmeta table?
Here’s array of what get_field gives me:
Array
(
[0] => Array
(
[type] => date
[date] => 2022-02-10
[newdate] => Array
(
[0] =>
[1] =>
)
[price] => 124
[sale_price] => 421
[unit] =>
)
[1] => Array
(
[type] => daterange
[date] =>
[newdate] => Array
(
[0] => 2022-02-16
[1] => 13/02/2022
)
[price] => 436643
[sale_price] => 634643
[unit] => single
)
)