We can order pages by title.
Also we can sort them by menu_order.
Is it possible, to order pages by menu_order and title at the same time?
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityUse 'orderby' => 'title menu_order'
or &orderby=title menu_order
(depending of the syntax you use for your query parameters).
I don't yet have enough rep to comment so I will have to post this tidbit as an answer instead.
Since WP 4.0, you may compound any of the available orderby
values by padding them as a space-delimited list.
This is somewhat documented here
orderby
will also parse a space-delimited set of columns:
$q = new WP_Query( array( 'orderby' => 'title author' ) );
Prior to 4.0, there was a problem: the value for
order
would only be applied to the last value that you passed in that space-delimited list, producing anORDER BY
clause like:
ORDER BY post_title, post_author DESC
In answer to your question, you may use 'orderby' => 'menu_order title'