Opened 11 years ago
Closed 11 years ago
#34516 closed defect (bug) (fixed)
wp_get_document_title() and post type archives by author
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 4.4 | Priority: | normal |
| Severity: | normal | Version: | 4.4 |
| Component: | Themes | Keywords: | has-patch |
| Focuses: | template | Cc: |
Description
Previously, wp_title() ran a check when is_author() like so:
if ( is_author() && ! is_post_type_archive() ) {
$author = get_queried_object();
if ( $author ) {
$title = $author->display_name;
}
}
This made sense when viewing a post type archive by author like example.com/?post_type=post_type&author=author_nicename.
However, wp_get_document_title() doesn't check this:
} elseif ( is_author() && $author = get_queried_object() ) {
$title['title'] = $author->display_name;
The following notice is now given on post type archives by author:
Notice: Undefined property: stdClass::$display_name in C:\xampp\htdocs\wp-includes\general-template.php on line 875
This is because the queried object is actually the post type object rather than the author/user object.
Attachments (3)
Change History (10)
#2
@
11 years ago
- Component changed from General to Themes
- Focuses template added
- Keywords has-patch added
- Milestone changed from Awaiting Review to 4.4
- Owner set to obenland
- Status changed from new to accepted
#4
@
11 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
@obenland: $authordata doesn't get set up if $wp_query->post is empty, means empty author archives will have an empty 'title' part.
#5
@
11 years ago
34516.2.diff reverts [35700] and reorders template checks to be in line with WP_Query::get_queried_object().
At some point we should double-check and update get_body_class(), get_the_archive_title() etc.
Note that this was fixed for
wp_title()in [28251].