Updating postmeta table via hook (cloned field)

Support MB Frontend Submission Updating postmeta table via hook (cloned field)Resolved

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #39807
    Amy SchmidtAmy Schmidt
    Participant

    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

    #39874
    PeterPeter
    Moderator

    Hello Amy,

    I will close this topic and reply here https://support.metabox.io/topic/why-wouldnt-this-update-the-data/

Viewing 2 posts - 1 through 2 (of 2 total)
  • The topic ‘Updating postmeta table via hook (cloned field)’ is closed to new replies.