Support

Account

Home Forums Backend Issues (wp-admin) add_sub_row() not working with get_field() and keys

Unread

add_sub_row() not working with get_field() and keys

  • Hey,

    if I want to add a row to an empty repeater field with PHP, I have to do this with the key instead of the field name – at least that’s what the documentation or the forum says.

    $tab_counter = 1;
    
    $row = array(
        'field_5d9d98b53171a' => "temp!", // Field name "title"
    );
    add_sub_row(array("field_5d7fa8d4b9142", $tab_counter, 'field_5d7fa941b9144'), $row, $machine_id);

    This also works. Now I would like to access the value with the help of the field name, but unfortunately this does not work anymore

    var_dump(get_field("title")); // Returns NULL

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.