NO BUG: ACF Relationship Query loop showing Draft content

ACF Relationship Query loop showing draft content - no way to filter by published status.

The field is working in all other respects, just no options in the “type > ACF Relationship” input to specify published only status.
Not sure if this is a bug or a feature request - but i as it currently is, it makes it problematic to use. I can’t see why you’d ever want to loop draft posts…
eg. also makes any other conditional display elements think there is post content when in fact they are draft status.
I can add a published status conditions on the loop element (as @timmse describes below) , but i want to hide a section when there is no content , not just the looped element.

Hi @timmse - should i just contact support directly about this?

The query for related “current jobs” shows a post thats has draft status - so i’ll be getting…

…when users click the link.

Here is the example:

Best
Pete

there is a high probability this is related to your acf setup or acf array.

bricks loop just gets the loop arguments and runs it as wp_query class thats all it does really.

1 Like

Hi Pete,
If you think you have found a bug, please post your report with reproducible steps in the “bugs” category and not in “how to” :slight_smile:

It seems as if the “Filter by post status” setting of the ACF relationship field is currently not supported, but you can use a “post status” condition on your loop item, which works fine as far as I can see.

1 Like

Whoops - sorry @timmse i changed the category

I do already have a condition set up to hide the section if there is no ACF relationship content which works . - but not when there is a related draft post - just also treating Drafts as “Not Empty”

Setting this condition on the Filtered block works but means i still see and empty section and title

Hi Pete,
Add a condition to your loop item that checks the post status (see my previous screenshot).

Hi @timmse , that doesn’t help with being able to add a condition to hide the section if there is no published content i’m afraid, only the looped item.

Hi Pete,
All right, time to try some magic :magic_wand:

  1. Setup your loop like this (search for your relationship field in “include”):

  2. Now you can use {query_results_count:xxx} (replace xxx with the Bricks ID of the loop) in a condition on the section. If there are only draft posts, the results count will be 0, and the section won’t show.

1 Like

You are a wizzard @timmse - as usual you always go the extra mile, thanks so much, this will help with lots of other stuff too!

1 Like

… actually, after some trial and error, I took a look at the Academy and found what I was looking for :mage: