I’m using repeater fields to populate track listings for a radio show. As there is usually about 20 tracks per episode, is there a way to display 20 empty repeater rows instead of having to click to create rows manually?
Similar to the ‘minimum rows’ behaviour, but allowing the rows to be deletable.
Thanks,
Andy.
Let me know if you have any questions. There are some older answers to similar questions on the forums (and I answered some of them) but this has changed… loading a repeater has been pretty stable for a while
add_filter('acf/load_value/name=repeater_field_name', 'preload_repeater_field_name', 10, 3);
function preload_repeater_field_name($value, $post_id, $field) {
// $value will === NUL for new post
if ($value !== NULL) {
return $value;
}
$value = array_fill(0, 20, array());
return $value;
}
Amazing work, thanks. Works a charm.