[wp-trac] [WordPress Trac] #47068: get_queried_object() returns null date archives and on homepage with blog on front settings
WordPress Trac
noreply at wordpress.org
Tue Nov 25 13:46:19 UTC 2025
#47068: get_queried_object() returns null date archives and on homepage with blog
on front settings
--------------------------+------------------------------
Reporter: bplv | Owner: (none)
Type: defect (bug) | Status: reopened
Priority: normal | Milestone: Awaiting Review
Component: Query | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
--------------------------+------------------------------
Changes (by iflairwebtechnologies):
* keywords: => has-patch
* version: => trunk
Comment:
Fixes an issue where WP_Query::get_queried_object() returns null on valid
queries.
This patch adds missing queried_object handling for:
1. Date archives (year, month, day)
2. Homepage when “Your latest posts” is selected
Returning null causes problems in:
- Themes expecting valid queried objects
- Breadcrumb plugins (Yoast, RankMath)
- Conditional templates using queried_object_id
- Custom theme frameworks relying on WP_Query consistency
This patch introduces lightweight stdClass objects for both cases,
matching how post type archives and taxonomy queries work, without
altering existing behavior.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/47068#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list