[wp-trac] [WordPress Trac] #56841: WordPress pagination broken after updating to 6.0

WordPress Trac noreply at wordpress.org
Tue Nov 7 18:40:23 UTC 2023


#56841: WordPress pagination broken after updating to 6.0
--------------------------+-------------------------------
 Reporter:  wpfed         |       Owner:  (none)
     Type:  defect (bug)  |      Status:  reopened
 Priority:  normal        |   Milestone:  6.5
Component:  Query         |     Version:  6.0
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:  coding-standards
--------------------------+-------------------------------

Comment (by wpfed):

 Thanks for confirming @afercia That is how the queries look on the server
 when I saved them. I saved the queries on my server, one with current
 implementation and one with trim() or spaces removed:

 Without space removal:

 {{{#!php
 <?php
                                         SELECT SQL_CALC_FOUND_ROWS
 wp_posts.ID
                                         FROM wp_posts  LEFT JOIN
 wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id)
 LEFT JOIN wp_term_relationships AS tt1 ON (wp_posts.ID = tt1.object_id)
                                         WHERE 1=1  AND (
   wp_term_relationships.term_taxonomy_id IN (5)
   AND
 }}}

 With space removal:

 {{{#!php
 <?php
 SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID
                                         FROM wp_posts  LEFT JOIN
 wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id)
 LEFT JOIN wp_term_relationships AS tt1 ON (wp_posts.ID = tt1.object_id)
                                         WHERE 1=1  AND (
   wp_term_relationships.term_taxonomy_id IN (5)
   AND
 }}}

 trim() function doesn't even need to be used, just changing the formatting
 so it's more constent with the rest of the select queries:

 {{{#!php
 <?php
 $this->request = "
                                         SELECT $found_rows $distinct
 {$wpdb->posts}.ID
                                         FROM {$wpdb->posts} $join
                                         WHERE 1=1 $where
                                         $groupby
                                         $orderby
                                         $limits
                                 ";

 }}}

 With new formatting:
 {{{#!php
 <?php
 $this->request = "SELECT $found_rows $distinct {$wpdb->posts}.ID
                                         FROM {$wpdb->posts} $join
                                         WHERE 1=1 $where
                                         $groupby
                                         $orderby
                                         $limits
                                 ";

 }}}

 I'll try to work on this today but preference is to not use trim()
 function.

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


More information about the wp-trac mailing list