diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index beae029b13..f554e1fdc5 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -847,10 +847,27 @@ function wp_get_document_title() { 'title' => '', ); + // If it's a 404 page, use a "Page not found" title. + if ( is_404() ) { + $title['title'] = __( 'Page not found' ); + + // If it's a search, use a dynamic search results title. + } elseif ( is_search() ) { + /* translators: %s: search phrase */ + $title['title'] = sprintf( __( 'Search Results for “%s”' ), get_search_query() ); + // If on the home or front page, use the site title. - if ( is_home() && is_front_page() ) { + } elseif ( is_home() && is_front_page() ) { $title['title'] = get_bloginfo( 'name', 'display' ); + // If on a post type archive, use the post type archive title. + } elseif ( is_post_type_archive() ) { + $title['title'] = post_type_archive_title( '', false ); + + // If on a taxonomy archive, use the term title. + } elseif ( is_tax() ) { + $title['title'] = single_term_title( '', false ); + /* * If we're on the blog page and that page is not the homepage or a single * page that is designated as the homepage, use the container page's title. @@ -862,22 +879,13 @@ function wp_get_document_title() { } elseif ( is_singular() ) { $title['title'] = single_post_title( '', false ); - // If on a category or tag or taxonomy archive, use the archive title. - } elseif ( is_category() || is_tag() || is_tax() ) { + // If on a category or tag archive, use the term title. + } elseif ( is_category() || is_tag() ) { $title['title'] = single_term_title( '', false ); - // If it's a search, use a dynamic search results title. - } elseif ( is_search() ) { - /* translators: %s: search phrase */ - $title['title'] = sprintf( __( 'Search Results for “%s”' ), get_search_query() ); - // If on an author archive, use the author's display name. - } elseif ( is_author() ) { - $title['title'] = get_the_author(); - - // If on a post type archive, use the post type archive title. - } elseif ( is_post_type_archive() ) { - $title['title'] = post_type_archive_title( '', false ); + } elseif ( is_author() && $author = get_queried_object() ) { + $title['title'] = $author->display_name; // If it's a date archive, use the date as the title. } elseif ( is_year() ) { @@ -888,10 +896,6 @@ function wp_get_document_title() { } elseif ( is_day() ) { $title['title'] = get_the_date(); - - // If it's a 404 page, use a "Page not found" title. - } elseif ( is_404() ) { - $title['title'] = __( 'Page not found' ); } // Add a page number if necessary. diff --git a/wp-includes/version.php b/wp-includes/version.php index a2d7d52eba..427a27ffdb 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-beta4-35705'; +$wp_version = '4.4-beta4-35706'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.