Problem : Saving a sub-field of a group into a separated custom field

Support MB Group Problem : Saving a sub-field of a group into a separated custom fieldResolved

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #42216
    JoeJoe
    Participant

    Hi,

    i ran across this code to copy data from a custom field in a group to a custom field outside a group :

    add_action( 'rwmb_event-details_after_save_post', function( $object_id ) {
        $event = $_POST['event'];
        $date = $event['date'];
        update_post_meta( $object_id, 'event_date', $date );
    } );

    I cannot get this to work.
    My setup :
    A. I have a CPT called 'method'
    B. I have setup a group 'test_group'
    C. I have a custom text field inside this group called 'data_in_group'
    D: I have a custom text field coutside the group 'data_outside_group'

    I am using the following code to test if any data gets inserted upon save :

    add_action( 'rwmb_method_after_save_post', function( $object_id ) {
        $test_insert = '123';
        update_post_meta( $object_id, 'data_outside_group', $test_insert );
    } );

    But this does not work, can you tell me why, what am I doing wrong ?

    #42217
    JoeJoe
    Participant

    Sorry I forgot to add : this is supposed to work in the BACKend

    #42218
    JoeJoe
    Participant

    please disregard my bad, sorry

    #42219
    JoeJoe
    Participant

    working now

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.