Make WordPress Core

Changeset 51969


Ignore:
Timestamp:
11/01/2021 10:31:56 PM (3 years ago)
Author:
joedolson
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/admin-header.php

    r51837 r51969  
    2323 * @global int       $total_update_count
    2424 * @global string    $parent_file
     25 * @global string    $typenow
    2526 */
    2627global $title, $hook_suffix, $current_screen, $wp_locale, $pagenow,
    27     $update_title, $total_update_count, $parent_file;
     28    $update_title, $total_update_count, $parent_file, $typenow;
    2829
    2930// Catch plugins that include admin-header.php before admin.php completes.
     
    5657    /* translators: %s: Admin screen title. */
    5758    $admin_title = sprintf( __( 'Recovery Mode — %s' ), $admin_title );
     59}
     60
     61if ( 'post' === $current_screen->base && 'add' !== $current_screen->action ) {
     62    $post_title = get_the_title();
     63    if ( ! empty( $post_title ) ) {
     64        $obj = get_post_type_object( $typenow );
     65        /* translators: Editor admin screen title. 1: "Edit item" text for the post type, 2: Post title. */
     66        $admin_title = sprintf( __( '%1$s “%2$s”' ), $obj->labels->edit_item, $post_title );
     67    }
    5868}
    5969
Note: See TracChangeset for help on using the changeset viewer.