[wp-trac] [WordPress Trac] #57272: Bug in main query

WordPress Trac noreply at wordpress.org
Sun Dec 4 12:01:22 UTC 2022


#57272: Bug in main query
--------------------------+-----------------------------
 Reporter:  brahimwpk     |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  6.1.1
 Severity:  normal        |   Keywords:  has-patch
  Focuses:                |
--------------------------+-----------------------------
 Hello community,

 After a days of debugging i found a bug in wordpress core related to query
 var 'm', in the case that allows to get posts of a month.

 wp-includes/class-wp-query.php in this bloc

 if ( $q['m'] ) {
     if(strlen( $q['m'] ) == 6){

 i changed the where statement :

 $where .= " AND {$wpdb->posts}.post_date <= '$end_date' AND
 {$wpdb->posts}.post_date >= '$start_date' ";

 to :

 $where .= " AND {$wpdb->posts}.post_date <= '$end_date 23:59:59' AND
 {$wpdb->posts}.post_date >= '$start_date' ";

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57272>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list