Make WordPress Core

Opened 2 years ago

Last modified 2 years ago

#57272 new defect (bug)

Bug in main query

Reported by: brahimwpk's profile brahimwpk Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.1.1
Component: General Keywords: has-patch reporter-feedback
Focuses: Cc:

Description (last modified by johnbillion)

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

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

i changed the where statement :

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

to :

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

Attachments (1)

Capture du 2022-12-04 13-02-33.png (111.2 KB) - added by brahimwpk 2 years ago.

Download all attachments as: .zip

Change History (3)

#1 @johnbillion
2 years ago

  • Description modified (diff)
  • Keywords reporter-feedback added

Thanks for the report @brahimwpk . What's the actual bug you're seeing please?

#2 @SergeyBiryukov
2 years ago

Hi there, welcome to WordPress Trac!

Just linking to some tickets that might be related: #26653, #29908.

Note: See TracTickets for help on using tickets.