Make WordPress Core

Opened 4 years ago

Closed 13 months ago

Last modified 9 months ago

#57272 closed defect (bug) (invalid)

Bug in main query

Reported by: brahimwpk Owned by:
Priority: normal Milestone:
Component: General Version: 6.1.1
Severity: normal Keywords: reporter-feedback close
Cc: Focuses:

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 4 years ago.

Download all attachments as: .zip

Change History (6)

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

Hi there, welcome to WordPress Trac!

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

#3 @mindctrl
15 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
13 months ago

  • Resolutioninvalid
  • Status newclosed

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. 😃

#5 @swissspidy
9 months ago

  • Milestone Awaiting Review

Removing milestone from closed ticket.

Note: See TracTickets for help on using tickets.