Home › Forums › Bug Reports › Cloned fields inherit/save data to and from sibling cloned fields (with prefix) › Reply To: Cloned fields inherit/save data to and from sibling cloned fields (with prefix)
I know this is marked as solved, but there is a way to get this to work (tested on ACF Pro 5.4.1).
Follow the same steps as outlined by fatsoma in “To repeat manually:” only change the Display from Seamless to Group within each clone field.
This allows each duplication of the same clone content to be saved into the posts meta. This “feature” may be (probably is) a bug as from here you can’t access the data using the normal have_rows() and get_sub_field() method, but instead need to build your own.
I’m using something like:
// get the flexible content
$flexible_content = get_field('flexible_content_name');
foreach( $flexible_content as $flexible_row ) {
// find out which layout is being used
$acf_fc_layout = $flexible_row['acf_fc_layout'];
echo '<h1>'. $acf_fc_layout .'</h1>';
// knock the first index off to get at the goodies
array_splice($flexible_row, 0, 1);
// get content data
foreach($flexible_row as $key=>$val) {
echo '<h1>'.$key.'</h1>';
?><pre><?php
print_r($val);
?></pre><?php
echo $val['field_name'];
}
}
to get at the fields which is pretty janky, but works.
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.