DEV Community

mhsohag11
mhsohag11

Posted on

Answer: WP_Query orderby meta_value_num not working

I know it's old question, byt maybe my answer will help somebody.

Problem here is that prices are strings as @muka-gergely mentioned, so 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…

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay