Support

Account

Home Forums Backend Issues (wp-admin) Fields in Database but not in admin page Reply To: Fields in Database but not in admin page

  • I’ve been looking into this a bit since I commented in the other topic. I found an interesting topic on stackoverflow. They suggest using update_field() on the repeater, supplying an array of values instead of trying to add sub fields.

    http://stackoverflow.com/questions/24879399/wordpress-acf-how-to-add-rows-to-a-repeater-field-attached-to-a-user-via-custom

    With this in mind I took a look at the documentation for update_field() http://www.advancedcustomfields.com/resources/update_field/. This is actually covered there, it says taxonomy, but it could be used on a post, taxonomy is just used so that the example has a duel purpose.

    
    /*
    *  add a repeater row on a taxonomy!!!
    */
    
    $field_key = "repeater_field";
    $post_id = "event_123";
    $value = get_field($field_key, $post_id);
    $value[] = array("sub_field_1" => "Foo", "sub_field_2" => "Bar");
    update_field( $field_key, $value, $post_id );