I have written the following query to fetch a list and want to show the list of names in ascending order.
I was earlier trying to pass meta_key
and meta_value
as arguments but it would not give the sorting correctly.
After trying meta_query
I'm still stuck with the same problem.
$connected = new WP_Query(
array(
'connected_type' => 'posts_to_pages',
'connected_items' => get_queried_object(),
'nopaging' => true,
'post_type' => 'attorney',
'attorney_category' => 'partner',
'post_status' => 'publish',
'posts_per_page' => - 1,
'caller_get_posts' => 1,
'orderby' => 'order_clause',
'order' => 'ASC',
'meta_query' => array(
'order_clause' => array(
'key' => 'Last name',
)
)
)
);
The following is the error I get when I print the query result: