[wp-trac] [WordPress Trac] #57767: SQL query error with multiple order specifications in pre_get_posts.

WordPress Trac noreply at wordpress.org
Tue Feb 21 02:16:26 UTC 2023


#57767: SQL query error with multiple order specifications in pre_get_posts.
--------------------------+------------------------------
 Reporter:  kuroro111     |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Query         |     Version:  6.1.1
 Severity:  critical      |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by kuroro111):

 {{{
 SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID
                                         FROM wp_posts  LEFT JOIN
 wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id )  LEFT JOIN
 wp_postmeta AS mt1 ON ( wp_posts.ID = mt1.post_id )  LEFT JOIN wp_postmeta
 AS mt2 ON ( wp_posts.ID = mt2.post_id AND mt2.meta_key = 'プラン' )
                                         WHERE 1=1  AND (
   wp_postmeta.meta_key = 'プラン'
   AND
   (
     mt1.meta_key = 'プラン'
     OR
     mt2.post_id IS NULL
   )
 ) 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
 DESC, wp_posts.post_date DESC
                                         LIMIT 0, 10
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57767#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list