From 201f4ddfbe9083db2ac4225d93ad09c1318062f0 Mon Sep 17 00:00:00 2001 From: joedolson Date: Sun, 7 Nov 2021 22:09:56 +0000 Subject: [PATCH] Editor: Update structure of title element for editing. Re-format the title element for post editing to follow general scheme for WordPress admin screens. Props SergeyBiryukov. Fixes #52314. Built from https://develop.svn.wordpress.org/trunk@52030 git-svn-id: http://core.svn.wordpress.org/trunk@51622 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/admin-header.php | 26 ++++++++++++++++---------- wp-includes/version.php | 2 +- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/wp-admin/admin-header.php b/wp-admin/admin-header.php index 767276b974..9106c63a03 100644 --- a/wp-admin/admin-header.php +++ b/wp-admin/admin-header.php @@ -49,8 +49,23 @@ if ( $admin_title === $title ) { /* translators: Admin screen title. %s: Admin screen name. */ $admin_title = sprintf( __( '%s — WordPress' ), $title ); } else { + $screen_title = $title; + + if ( 'post' === $current_screen->base && 'add' !== $current_screen->action ) { + $post_title = get_the_title(); + if ( ! empty( $post_title ) ) { + $post_type_obj = get_post_type_object( $typenow ); + $screen_title = sprintf( + /* translators: Editor admin screen title. 1: "Edit item" text for the post type, 2: Post title. */ + __( '%1$s “%2$s”' ), + $post_type_obj->labels->edit_item, + $post_title + ); + } + } + /* translators: Admin screen title. 1: Admin screen name, 2: Network or site name. */ - $admin_title = sprintf( __( '%1$s ‹ %2$s — WordPress' ), $title, $admin_title ); + $admin_title = sprintf( __( '%1$s ‹ %2$s — WordPress' ), $screen_title, $admin_title ); } if ( wp_is_recovery_mode() ) { @@ -58,15 +73,6 @@ 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. * diff --git a/wp-includes/version.php b/wp-includes/version.php index d64fdab1d1..91f5e85a1c 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '5.9-alpha-52029'; +$wp_version = '5.9-alpha-52030'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.