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 #52314.
Built from https://develop.svn.wordpress.org/trunk@51969


git-svn-id: http://core.svn.wordpress.org/trunk@51558 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
joedolson 2021-11-01 22:32:58 +00:00
parent 1c73f953c3
commit a841368a3e
2 changed files with 12 additions and 2 deletions

View File

@ -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.
*

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.9-alpha-51968';
$wp_version = '5.9-alpha-51969';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.