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.
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 );
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.