Orderby custom meta returns random order

I also added this here for someone else having same issue.

If your meta values are numeric then you should use orderby meta_value_num instead of meta_value.

As mentioned in codex.

  • meta_value – Note that a meta_key=keyname must also be present in the query. Note also that the sorting will be alphabetical which is fine for strings (i.e. words), but can be unexpected for numbers (e.g. 1, 3, 34, 4, 56, 6, etc, rather than 1, 3, 4, 6, 34, 56 as you might naturally expect). Use meta_value_num instead for numeric values.

  • meta_value_num – Order by numeric meta value (available with Version 2.8). Also note that a meta_key=keyname must also be present in the query. This value allows for numerical sorting as noted above in meta_value.

tech