Support

Account

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?