Make WordPress Core

Opened 18 months ago

Last modified 18 months 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

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' ";

Attachments (1)

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

Download all attachments as: .zip

Change History (3)

#1 @johnbillion
18 months ago

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

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

#2 @SergeyBiryukov
18 months 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.