WP_Query and is_day() bug
|Reported by:||raliste||Owned by:||ryan|
|Component:||Canonical||Keywords:||has-patch needs-testing commit 3.7-early|
When you configure Wordpress with permalinks such as /%year%/%month% and even /%year%/%month%/%day/ there is
a failure when you request URLs like /2009/10/58, because it's still generating the query to the database
(AND YEAR(wp_posts.post_date)='2009' AND MONTH(wp_posts.post_date)='10' AND DAYOFMONTH(wp_posts.post_date)='58').
Also, is_day() returns true, when it should be returning false.
As adding a post with that date is nearly impossible trough the wordpress admin or the database, no posts will be found, so
Wordpress will show "No page found", but with HTTP status 200 OK, not 404 Not Found.
I think it's important to validate the day on the applicacion side, so for some ideas to work correctly under WP
(like take advantage of sticky posts and show all post for the month in day requests), and most importantly to save
those wasted mysql queries.
Of course I could validate the day using a filter, but that is not the general idea!
Change History (30)
- Keywords needs-patch added
- Milestone set to Future Release
- Severity changed from major to normal
comment:7 wonderboymusic — 20 months ago
- Component changed from Query to Canonical
- Keywords has-patch added; needs-patch removed