Hey all,
I have an issue, I manged to add some images programatically into a repeater field using update_sub_field, this works as I can see them in the database, however I cannot see them in the “edit page” of the post or in the post if I try to echo out the values.
What is going on? Is this a bug, is there a workaround? I can literally look at the repeater entries in the database but they dont show up in wordpress.
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 );
This reply has been marked as private.
I have exactly the same problem: the fields are in the database (which I don’t have access to), but they don’t appear on the page. How can I edit these? Or can I override existing fields (I suppose not)?
Thanks for you help!