Home › Forums › General Issues › meta_query orderby overwritten by publish date › Reply To: meta_query orderby overwritten by publish date
Hi John,
I wasn’t able to get that filter working to log the queries in the error log, but I did do a print_r on the query array and got the MySQL query:
SELECT wp_posts.* FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) INNER JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id ) INNER JOIN wp_postmeta AS mt1 ON ( wp_posts.ID = mt1.post_id ) WHERE 1=1 AND (
wp_term_relationships.term_taxonomy_id IN (4,5,33,34,35,41)
) AND (
wp_postmeta.meta_key = 'schedule_time_start'
AND
(
( mt1.meta_key = 'date' AND CAST(mt1.meta_value AS CHAR) LIKE '%1470268800%' )
OR
( mt1.meta_key = 'day' AND CAST(mt1.meta_value AS CHAR) LIKE '%1470268800%' )
)
) AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled' OR wp_posts.post_status = 'private') GROUP BY wp_posts.ID ORDER BY wp_postmeta.meta_value+0 ASC
See anything unusual?
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
🚀 This week’s session of ACF Chat Fridays dips into the preliminary results of our first ever user survey. Don’t miss it! https://t.co/3UtvQbDwNm pic.twitter.com/kMwhaJTkZc
— Advanced Custom Fields (@wp_acf) May 9, 2023
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.