Hello!
I have a custom post type called ‘project’. This post type has an ACF user field associated with it called “repetiture_access”. I’d like to create a list of project posts where the current user is one of the users listed in the ACF user field. I’ve got this code but it’s not working:
<Set name=curr_user>
<Field user_field="id" />
</Set>
<Loop type="project" custom_field="repetiture_access" custom_field_compare=in custom_field_value="{Get curr_user}" >
<p><Field title /> (<Field repetiture_access />)</p>
</Loop>
This Loop statement yields no results even when I have users specified in the repetiture_access field for some posts.
In my testing, getting the curr_user variable outputs 1 - no quotes. If I output the value of the ACF user field using only the Field tag, I get an array of values in quotes (i.e. [“1”,“3”,“2”]). This makes me think I may be comparing numbers to strings which is why the loop isn’t yielding any results.
As a test, this loop yields results, only posts with users in the ACF user field:
<Set name=curr_user>
<Field user_field="id" />
</Set>
<Loop type="project" custom_field="repetiture_access" >
<p><Field title /> (<Field repetiture_access />)</p>
</Loop>
What am I doing wrong?