All good, worked it out by putting it through the loop then accessing the sub_fields!
<?php
if( have_rows('album_group') ):
while( have_rows('album_group') ): the_row();
$cp_album_info = get_sub_field('album_information');
$cp_album_music = get_sub_field('album_music_g');
$cp_album_name = get_sub_field('campaign_album_name');
$cp_album_links = get_sub_field('album_links');
...
?>
Got it working by removing the foreach and just spitting out the return value:
add_filter('acf/load_value/key=field_599774ca9d074', 'ek_option_defaults', 10, 3);
function ek_option_defaults($value, $post_id, $field) {
if ($value === false) {
$value = array(
array(
'field_59977c2759a56' => '24 hours ago',
'field_599841d665210' => '',
),
array(
'field_59977c2759a56' => '3 days ago',
'field_599841d665210' => '',
),
array(
'field_59977c2759a56' => '7 days ago',
'field_599841d665210' => '',
),
//etc
);
}
return $value;
}
@hube2 Ah I see! Thanks. I’ve switched, but fields are still not appearing once the ek-search-date
repeater is empty. Also tried on a new install and set to key
instead of name
. Is there another set I’m missing?
Thanks!
UPDATE:
2 Fields will output as blank if I change to:
if ($value === NULL) {
return $value;
}