Hi,
I have updated my query, but it still isn't working, could you please help get it working.
Here is the updated query:
$args = array(
'post_type' => 'condo',
'post_status' => 'publish',
'posts_per_page' => '12', // you may edit this number
'paged' => $paged,
'meta_query' => array (
'listing_clause' => array (
'key' => 'wpcf-listing-status',
'value' => '3',
'compare' => '='
),
),
'orderby' => array(
'meta_value_num' => 'DESC',
'date' => 'DESC'
),
'meta_key' => 'wpcf-sold-date',
'meta_type' => 'DATE'
);
Here is what it shows as the Select that this produces:
SELECT SQL_CALC_FOUND_ROWS ms15_posts.ID
FROM ms15_posts
INNER JOIN ms15_postmeta ON ( ms15_posts.ID = ms15_postmeta.post_id )
INNER JOIN ms15_postmeta AS mt1 ON ( ms15_posts.ID = mt1.post_id )
WHERE 1=1 AND ( ms15_postmeta.meta_key = 'wpcf-sold-date' AND ( ( mt1.meta_key = 'wpcf-listing-status' AND CAST(mt1.meta_value AS CHAR) = '3' ) ) ) AND ms15_posts.post_type = 'condo' AND ((ms15_posts.post_status = 'publish'))
GROUP BY ms15_posts.ID
ORDER BY ms15_posts.menu_order, ms15_postmeta.meta_value+0 DESC, ms15_posts.post_date DESC LIMIT 0, 12
which has the wpcf-sold-date in the WHERE clause instead of in the ORDER By clause.
So, I then tried:
$args = array(
'post_type' => 'condo',
'post_status' => 'publish',
'posts_per_page' => '12', // you may edit this number
'paged' => $paged,
'meta_query' => array (
'listing_clause' => array (
'key' => 'wpcf-listing-status',
'value' => '3',
'compare' => '='
),
),
'orderby' => array(
array (
'meta_value_num' => 'DESC',
'meta_key' => 'wpcf-sold-date',
'meta_type' => 'DATE'
),
'date' => 'DESC'
),
);
and got this SELECT:
SELECT SQL_CALC_FOUND_ROWS ms15_posts.ID
FROM ms15_posts
INNER JOIN ms15_postmeta ON ( ms15_posts.ID = ms15_postmeta.post_id )
WHERE 1=1 AND ( ( ms15_postmeta.meta_key = 'wpcf-listing-status' AND CAST(ms15_postmeta.meta_value AS CHAR) = '3' ) ) AND ms15_posts.post_type = 'condo' AND ((ms15_posts.post_status = 'publish'))
GROUP BY ms15_posts.ID
ORDER BY ms15_posts.menu_order, ms15_posts.post_date DESC LIMIT 0, 12
which totally lost the ordering by wpcf-sold-date.
Any ideas how to get the $arg so it works like it used to in 4.1?
Thank you.