WIP: ACF empty value in nested query loop

Hello :slight_smile:

I’ve just encountered some issue on my company’s website and because previously the feature was working and no changes except theme update was made, I assume it’s a bug or some misunderstanding from my side.

We have a query loop that iterates over ACF Repeater Field which contains years of publish ([2024,2023…]). Inside we have another query loop that displays post which ‘year’ matches value from repeater (like here → Query Loop – Bricks Academy but instead changing ‘post_type’ we change ‘year’).

$year = '{acf_media_o_nas_rok_publikacji}';

return [
    'post_type' => 'in-media',
    'year' => $year,
  	'nopaging' => true,
];

While using {acf_media_o_nas_rok_publikacji} the year is returned properly as long as is used outside inner query loop. Inside posts loop {acf_media_o_nas_rok_publikacji} returns empty value so it displays all posts.

So:

  • the feature worked before 1.9.7 update
  • acf_field works properly outside inner query loop
  • i tried changing 'year' => $year, to 'year' => [$year], and 'date_query' => ['year' => $year], but nothing changed, however 'year' => 2022, or 'year' => '2022', works

I would appreciate some help.
Thanks in advance :slight_smile:

Hi Jakub,
Welcome to the forum, and thanks so much for your report!

We have already received an email report on this problem that is almost identical to yours. The problem will probably be fixed in the next version. I will let you know when it is ready.

Best regards,
timmse

1 Like

Hi @timmse

Do we have any updates on this topic? :slight_smile: