All Topics
Default sorting not working
I have set some default sorting rules which other than default but it is not working. It worked with last update but no longer with latest update. Seems that the sorting is reseted to wp_posts.post_date DESC. See the query below which is captured with Query Browser.
SELECT SQL_CALC_FOUND_ROWS wp_posts.ID
FROM wp_posts
LEFT JOIN wp_postmeta
ON (wp_posts.ID = wp_postmeta.post_id
AND wp_postmeta.meta_key = 'rms_rm_uniq_meta_post_id' )
LEFT JOIN wp_postmeta AS mt1
ON (wp_posts.ID = mt1.post_id
AND mt1.meta_key = 'rms_remote_featured_image' )
WHERE 1=1
AND ( wp_postmeta.post_id IS NULL
AND mt1.post_id IS NULL )
AND wp_posts.post_type = 'shop_order'
AND ((wp_posts.post_status = 'wc-pending'
OR wp_posts.post_status = 'wc-processing'
OR wp_posts.post_status = 'wc-on-hold'
OR wp_posts.post_status = 'wc-completed'
OR wp_posts.post_status = 'wc-cancelled'
OR wp_posts.post_status = 'wc-refunded'
OR wp_posts.post_status = 'wc-failed'
OR wp_posts.post_status = 'wc-price-confirmed'
OR wp_posts.post_status = 'wc-payment-slip'
OR wp_posts.post_status = 'wc-ordered'
OR wp_posts.post_status = 'wc-shipping-to-wh'
OR wp_posts.post_status = 'wc-picked-up'
OR wp_posts.post_status = 'wc-shipping-to-mk'
OR wp_posts.post_status = 'wc-pending-sf'
OR wp_posts.post_status = 'wc-shipping-to-mb'
OR wp_posts.post_status = 'wc-ready-mk-pickup'
OR wp_posts.post_status = 'wc-posted'
OR wp_posts.post_status = 'wc-arrived-mb-wh'
OR wp_posts.post_status = 'wc-mk-transit'
OR wp_posts.post_status = 'wc-to-be-backed'
OR wp_posts.post_status = 'wc-waiting_refund_in'
OR wp_posts.post_status = 'wc-to-be-refunded'))
GROUP BY wp_posts.ID
<strong>ORDER BY wp_posts.post_date DESC</strong>
LIMIT 0, 100
I can see my setting appears in other queries which my preferred sorting. e.g.
SELECT wp_posts.*
FROM wp_posts
LEFT JOIN wp_postmeta
ON (wp_posts.ID = wp_postmeta.post_id
AND wp_postmeta.meta_key = 'rms_rm_uniq_meta_post_id' )
LEFT JOIN wp_postmeta AS mt1
ON (wp_posts.ID = mt1.post_id
AND mt1.meta_key = 'rms_remote_featured_image' )
WHERE 1=1
AND wp_posts.post_name = 'pending'
AND ( wp_postmeta.post_id IS NULL
AND mt1.post_id IS NULL )
AND wp_posts.post_type = 'wc_order_status'
AND ((wp_posts.post_status = 'publish'))
GROUP BY wp_posts.ID
<strong>ORDER BY wp_posts.menu_order ASC</strong>
You must be logged in to reply to this topic.