I'm at a loss and need some help.
I am using the front-end form + custom tables. Using the hook rwmb_frontend_before_save_post, I am able to manipulate the data before (or after) save with all the regular fields that are stored in their custom tables. However, the problem comes with the cloned data that gets stored both in it's custom table + the post_meta table.
And the frontend form seems to be pulling from the postmeta table rather than the custom one which means I need to update both.
The problem I'm having is updating the postmeta table!
I've tried a number of combinations, different methods, etc but this one seems the most logical:
($currentDate is the current date)
$oldData= get_post_meta ($ID,'units', true);
foreach($oldData as $data) {
$newDate = array(
'available' => $currentDate
);
update_post_meta( $ID, 'units', $newDate )
}
But when I run it, the post_meta table isn't updated.
Am I using the wrong hook? Is the code wrong? How would you suggest updating the 'available' field to today from inside any hook? Thanks for any help