I have created a custom post type which stores a rating value based on an answer provided to a question in a form. So e.g.
Item One
field 1 - question1_answer1 = 1
field 2 - question1_answer2 = 3
field 3 - question2_answer1 = 1
field 4 - question2_answer2 = 9
Item Two
field 1 - question1_answer1 = 9
field 2 - question1_answer2 = 3
field 3 - question2_answer1 = 6
field 4 - question2_answer2 = 1
Assuming question1_answer2
and question2_answer1
was selected.
Now I would like to return all items ordered based on their multiplied overall rating.
So Item Two (18) would come first and then Item One (3).
Is this feasible with a meta query? I am not able to figure it out. The only solution I could come up with is selecting all items, saving into an array and then using uasort()
.