What's wrong in this query ? the sortby=name doesn't change anything.

$the_query = 'posts_per_page=-1&sortby=name&order=ASC&post_type=mycustom&custom_cat=mycat';
// query is made               
  • Word of advice, never use query_posts. Use WP_Qeury or pre_get_posts instead Apr 29, 2014 at 13:53

1 Answer 1


The "sort" query param is usually "orderby" not "sortby", to match the SQL ORDER BY clause.

Perhaps try:

$the_query = 'posts_per_page=-1&orderby=name&order=ASC&post_type=mycustom&custom_cat=mycat';

It's also possible that the value you are passing is incorrect, but without knowing the details of your custom post type there's not much else I can suggest.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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