NO BUG: ACF true/false Only false condition works on relationship loop

Browser: Chrome 110
OS: macOS / Windows / Linux / etc.
URL: Link to a page that illustrates this issue
Video: Short screen recording that illustrates this issue (free tool: jam.dev)

I have a relationship field loop on a post type that renders perfectly, however inside that post (relationship) type I have a true/false field and I want to render the fields only if the value is true.
My setup is the following:

bricks

If i put the following condition to the loop div only the false condition returns the value.

**This condition works.**
Dynamic Data
{acf_personnel_active:value}
==
0
**This condition won't work.**
Dynamic Data
{acf_personnel_active:value}
==
1

bricks2

If I put the condition to the Element div, than the true condition also works but an empty loop div gets rendered.

I don’t know why the false condition works and the true doesn’t on the first version.

Not sure if this is a bug or am I doing something wrong.

1 Like

It sounds like the issue might be with how Bricks processes conditional logic on loops. Since the false condition works but the true one doesn’t, try explicitly casting the value to a boolean or checking for string vs. integer comparison issues. Also, test using {acf_personnel_active} instead of {acf_personnel_active:value} to see if that changes the behavior. If the issue persists, it could be a Bricks or ACF quirk, consider reaching out to their support or checking their forums for similar cases.

1 Like

@adilhassan thank you for your answer. :slight_smile:

I already tested the {acf_personnel_active} without the :value and I also did test it with is not comparison equators, but everything I tried goes back to rendering perfectly if the value is false and not rendering at all if the value is true.

I will try to search on ACF forums.

1 Like

simotamas7

sorry but cant help further as this is what I know!

1 Like

Hi Tamas,
Thanks so much for your report!

Please try this workaround by setting up your relationship query in a different way without using a condition (remove the condition):

Let me know if it works :v:

Best regards,
timmse

3 Likes

Hey @timmse
Thank you so much!
The workaround works as expected!

Great, you’re welcome :slight_smile:
The condition does not take effect because it is executed before the loop and returns always false. This is the expected behavior and not a bug.

1 Like