Home › Forums › Feature Requests › Repeater: default fields/data › Reply To: Repeater: default fields/data
I got this to work with ACF Pro 5.8.12, using the above code and code from this answer. Here’s what I added to my functions.php:
add_filter('acf/load_value/key=field_5eff2f9949765', 'acf_load_my_defaults', 10, 3);
function acf_load_my_defaults($value, $post_id, $field) {
if ($value === false) {
$value = array();
$value[] = array(
'field_5eff2fac49766' => 'Example Title One',
'field_5eff2fbd49767' => 'Some content for this block'
);
$value[] = array(
'field_5eff2fac49766' => 'Example Title Two',
'field_5eff2fbd49767' => 'Some content for this block'
);
}
return $value;
}
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!
Accordions are a great way to group related information while allowing users to interactively show and hide content. In this video, Damon Cook goes in-depth on how to create an accessible accordion block using ACF PRO’s Repeater field.https://t.co/RXT0g25akN
— Advanced Custom Fields (@wp_acf) March 2, 2023
© 2023 Advanced Custom Fields.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.