Thank you for trying keesiemeijer! But your suggestion give me the same result.
If I don’t set ‘orderby’ in my query, I think for default, it sorts the post by date DESC. But, when I set the sort by ‘action_votes_total’ the actions that have ‘votes’ shows up in the right order (from the most voted to the less), but the actions which don’t have any votes shows up in ASC order.
I just have the code running locally, but here is a print from the problem, where you can see the action ‘teste 03’ in first (because it have one vote) and the rest of the posts in ASC order (they should be in DESC order).
Thanks again!
Hi, here is the thing: I have a ‘challenge’ post (that is where $challenge_ID come from) and inside it a list of ‘actions’. What I need is to sort this list, first by the number of votes each action have (‘action_votes_total’) and then by their date.