I am using WP_Query. Here is my query:

$my_query = new WP_Query('category_name=test-category&posts_per_page=-1&meta_key=sort_name&orderby=meta_value_num&order=ASC');

Why is it grouping my posts this way? It's using the orderby value correctly, but for some reason subgrouping them by publish date.


My query was wrong. Should be using 'meta_value' instead of 'meta_value_num' since my 'sort_name' is text based, not numeric. Big thanks to John Huebner on the ACF message board for answering this one.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.