Custom Fields
Re-Envisioned
Support Meta Box Group update_post_meta for cloneable group fields

This topic contains 1 reply, has 2 voices, and was last updated by  Anh Tran 4 weeks ago.

  • Creator
    Topic
  • #16552
    Resolved
    Manoj Kumar
    Participant

    Hi,

    I need to update group cloneable meta fields programmatically. So, that I can loop through an array and update the post meta fields.

    Thanks in advance

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #16591

    Anh Tran
    Keymaster

    Hi Manoj,

    To update a cloneable group field, please use this snippet:

    $values = [];
    $values[] = [ 'sub_field_1' => 'value1', 'sub_field_2' => 'value2' ]; // Value of clone 1
    $values[] = [ 'sub_field_1' => 'value1', 'sub_field_2' => 'value2' ]; // Value of clone 2
    
    update_post_meta( $post_id, 'group_id', $values );
Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.