[wp-trac] [WordPress Trac] #55100: `get_queried_object()` doesn't work for `author_name` before `WP_Query::get_posts()`
WordPress Trac
noreply at wordpress.org
Sat Mar 5 15:33:20 UTC 2022
#55100: `get_queried_object()` doesn't work for `author_name` before
`WP_Query::get_posts()`
--------------------------------------+-----------------------------
Reporter: dd32 | Owner: SergeyBiryukov
Type: defect (bug) | Status: closed
Priority: normal | Milestone: 6.0
Component: Query | Version:
Severity: normal | Resolution: fixed
Keywords: has-patch has-unit-tests | Focuses:
--------------------------------------+-----------------------------
Changes (by SergeyBiryukov):
* owner: (none) => SergeyBiryukov
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"52822" 52822]:
{{{
#!CommitTicketReference repository="" revision="52822"
Query: Make sure `WP_Query::get_queried_object()` works for `author_name`
before `::get_posts()` is run.
Previously, the queried object with author data was not available before
the posts loop when `author_name` is used in the query instead of
`author`. With block themes, this use case appears to be more common to
display the author name in the header.
This commit adjusts the logic in `WP_Query::get_queried_object()` to fall
back to the `author_name` field if `author` is not present, similar to how
taxonomy slugs are handled.
Follow-up to [1728], [3290], [10992].
Props dd32, swissspidy, SergeyBiryukov.
Fixes #55100.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/55100#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list