Hi all,
I’m using the PHP Code Widget to generate custom JS for a specific calendar setup. However, I’m encountering an issue where I can’t retrieve data from the ACF fields.
Although the fields appear in var_dump
, I’m not getting any actual values.
Here’s a code snippet:
if (have_rows('b2c_repeater')):
while (have_rows('b2c_repeater')): the_row();
$erlebnis_buchung_block = get_sub_field('erlebnis_buchung_block'); //Group
var_dump($erlebnis_buchung_block);
endwhile;
endif;
The output looks like this:
array(4) {
["fareharbor_id"]=> string(0) ""
["fareharbor_voucher_id"]=> string(0) ""
["sprache_anzeigen"]=> string(2) "Ja"
["platz_anzeigen"]=> string(2) "Ja"
}
I’ve checked multiple times to ensure I’m iterating through the correct repeater and fields, and everything seems correct.
Oddly enough, if I add the same dynamic fields in another widget, the correct data is displayed. The issue persists whether I place the code in functions.php
or use a code-snippets plugin.
Does anyone have any idea what could be going wrong?
Thanks in advance!