Editor: Include post's title in editor title element.

Include the current post title in the `title` element when editing a post. Improve accessibility by distinguishing between different edit screens in the browser tab list. 

Props skierpage, alexstine, audrasjb, sabernhardt.
Fixes .

git-svn-id: https://develop.svn.wordpress.org/trunk@51969 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Joe Dolson 2021-11-01 22:31:56 +00:00
parent 400982add8
commit 054dac262f

@ -22,9 +22,10 @@ if ( ! defined( 'WP_ADMIN' ) ) {
* @global string $update_title
* @global int $total_update_count
* @global string $parent_file
* @global string $typenow
*/
global $title, $hook_suffix, $current_screen, $wp_locale, $pagenow,
$update_title, $total_update_count, $parent_file;
$update_title, $total_update_count, $parent_file, $typenow;
// Catch plugins that include admin-header.php before admin.php completes.
if ( empty( $current_screen ) ) {
@ -57,6 +58,15 @@ if ( wp_is_recovery_mode() ) {
$admin_title = sprintf( __( 'Recovery Mode — %s' ), $admin_title );
}
if ( 'post' === $current_screen->base && 'add' !== $current_screen->action ) {
$post_title = get_the_title();
if ( ! empty( $post_title ) ) {
$obj = get_post_type_object( $typenow );
/* translators: Editor admin screen title. 1: "Edit item" text for the post type, 2: Post title. */
$admin_title = sprintf( __( '%1$s “%2$s”' ), $obj->labels->edit_item, $post_title );
}
}
/**
* Filters the title tag content for an admin page.
*