Make WordPress Core

Opened 3 years ago

Closed 3 months ago

#57272 closed defect (bug) (invalid)

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: reporter-feedback close
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 3 years ago.

Download all attachments as: .zip

Change History (5)

#1 @johnbillion
3 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
3 years ago

Hi there, welcome to WordPress Trac!

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

#3 @mindctrl
5 months ago

  • Keywords close added; has-patch removed

Hi @brahimwpk, are you still experiencing the issue? If so, could you provide more details? It's not exactly clear what bug you were seeing. Also, the screenshot of the code does not match the current logic in WP_Query, so I'm wondering if what you were seeing is fixed now.

#4 @callumbw95
3 months ago

  • Resolution set to invalid
  • Status changed from new to closed

Hey all,

I think it is safe now to close this ticket is being closed due to inactivity. We haven't received any updates or responses from the reporter in over 3 years, and attempts to reproduce the issue have been unsuccessful. If the problem still exists, please provide more information or reopen the ticket, and we can take another look into this. 😃

Note: See TracTickets for help on using tickets.