Using Radio Fields With custom_field in the Loop

I’m trying to filter a loop by an ACF radio field, but it doesn’t seem to be working. I’ve tried both custom_field=radio_field and field=radio_field versions.

Can anyone see anything obvious that I’m doing wrong here:

<ul>
  <Loop type=my_cpt custom_field="radio_field" custom_field_value="target_value" orderby=title order=asc>
    <li>
        <a href="{Field url}"><Field title /></a>              
    </li>
  </Loop>
</ul>

My mistake - this turned out to be because of another issue. The radio field worked fine with custom_field="radio_field" custom_field_value="target_value" but the loop queries a CPT that uses a hierarchy and it wasn’t including any of the child posts in the output.

I’ve added it as a separate thread to make it easier for others to find in future. See: Include Child Posts in Loop in CPT With Hierarchy

1 Like