Skip to content

Instantly share code, notes, and snippets.

@am3000
Created June 26, 2017 12:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save am3000/af8555111d47373450e98ea63e4efd7c to your computer and use it in GitHub Desktop.
Save am3000/af8555111d47373450e98ea63e4efd7c to your computer and use it in GitHub Desktop.
Wordpress WP_Query order by title AND meta_key
$args = [
'post_type' => 'tq_team',
'posts_per_page' => -1,
'meta_key' => 'priority',
'orderby' => [
'meta_value_num' => 'ASC',
'title' => 'ASC'
]
];
$the_query = new WP_Query( $args );
// but how to order by multiple meta keys?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment