Home Forums Front-end Issues WP_query for each loop Reply To: WP_query for each loop

  • The reason that I think your having difficulty doing what your trying to do is that you’re trying to group the posts after you get the posts.

    get posts => look at field and => group the posts by the field

    Once you’ve gotten the posts and started looping through them it is too late to group them in a specific order. You need to set the order/grouping before you get them.

    To compound things further, your not only want them ordered by this field, but you also want them ordered in the same order as the field choices set in the ACF field. Depending on what this field holds it may not even be possible to order them.

    So, a couple of questions.

    Are the choices set in the field choices in alphanumeric order?

    Can the wheel_section field have more than one value?