Make WordPress Core

Opened 4 months ago

Last modified 41 hours ago

#52314 accepted defect (bug)

the HTML <title> tag for Edit Post should include the post's title

Reported by: skierpage Owned by: alexstine
Milestone: 5.8 Priority: normal
Severity: minor Version: 5.6
Component: Editor Keywords: has-patch has-screenshots
Focuses: accessibility, administration Cc:


  1. Open wp-admin > Posts > All Posts
  2. Hover over a post then click Edit

The web page's <title> tag is just "Edit Post ‹ your blog name — WordPress". There is no indication of what page you are editing. This makes it harder to later locate the tab in the browser, makes bookmarking posts you regularly edit harder, and the other problems of a poor web page title.

It would be nice to see part of the post's title in the web page's <title>, e.g. "Edit Post 'Britney Spears… evar' ‹ your blog name — WordPress"

VERSION: 5.6 in Firefox Nightly, running Linux on server and browser, using Gutenberg plug-in 9.7.0.

(This could be a bug in the Gutenberg editor rather than WordPress; there's code in src/wp-admin/edit.php to set the title:

$title = $post_type_object->labels->name;

but I'm not sure what it does.)

Attachments (5)

52314.diff (553 bytes) - added by audrasjb 42 hours ago.
Here is a first try on this ticket :)
Capture d’écran 2021-05-10 à 23.04.46.png (166.4 KB) - added by audrasjb 42 hours ago.
Result for a Page
Capture d’écran 2021-05-10 à 23.05.18.png (143.6 KB) - added by audrasjb 42 hours ago.
Edge case: Result on a new Post without any Title for now
Capture d’écran 2021-05-10 à 23.06.01.png (191.8 KB) - added by audrasjb 42 hours ago.
Result for a custom post type
52314-2.diff (783 bytes) - added by alexstine 41 hours ago.
Fix for Untitled.

Download all attachments as: .zip

Change History (20)

#1 @SergeyBiryukov
4 months ago

  • Component changed from General to Editor
  • Focuses administration added

#2 follow-up: @alexstine
4 months ago

  • Type changed from defect (bug) to enhancement

@skierpage Thanks for submitting a ticket.

I am not 100% for sure, but I'd say the reason why this isn't included in core is because of the recommended length for the "title" tag. Please see here.


The title should ideally be less than 64 characters in length.

That being said, you are not out of options. There is a core filter called "admin_title" and you can use it to adjust this for the post screen.


Here's a small snippet that I wrote on my test site. Do not use this in production until testing to make sure it works well for you. It will generate a title that looks like this.

<title>Edit Post: Testing ‹ example.com — WordPress</title>

This should work well across pages and posts. I tested using Classic Editor and Gutenberg.

add_filter( 'admin_title', 'change_admin_title_posts_screen', 10, 2 );
function change_admin_title_posts_screen( $admin_title, $title ) {
        global $post, $pagenow;
        if ( isset( $pagenow ) && 'post.php' == $pagenow ) { // Make sure we only change title on post.php
                $new_title = sprintf( __( '%1$s: %2$s &lsaquo; %3$s &#8212; WordPress' ),
                        $title, // Edit Post
                        $post->post_title, // Post title
                        get_bloginfo( 'name' ) // Blog title
                return $new_title; // Return new title
        } else {
                return $admin_title; // Sanity line to return default title

That is using the custom filter, you can add that snippet in a custom mu-plugin, plugin, or child theme for testing.

I'd say if anything, this is likely an "Enhancement", not a "Bug." I could not replicate any difference between Classic Editor and Gutenberg in 5.6. Maybe others have an opinion on this?

Hope it helps. Thanks.

#3 in reply to: ↑ 2 @skierpage
4 months ago

Replying to alexstine:
Thanks so much for responding and for the PHP code!

The title should ideally be less than 64 characters in length.

With a 14-character blog name, that still leaves 22 characters for the post title in "Edit Post 'Britney Spears greates…' ‹ your blog name — WordPress", excluding ellipsis. (My initial example truncated the middle of the post title, which is cool but probably overkill.) Also note the <title> of this Trac web page: it's 92 characters and includes the bug description because it's the right thing to do despite the W3C style guideline 😉.

#4 @peterhartree
5 weeks ago

+1 to this issue: I hate to think how much time I've spent trying to find the correct "Edit post" tab over the years.

For what it's worth, my quick thought is that the following <title> format would be best for most people:

Edit: [Post name] < [Blog name] — WordPress

I think we want as many words of the title as possible to be visible in the browser tab. Given that, including the post type (e.g. "Edit post:") does not seem above the bar.

For very long post names, it might make sense to truncate a bit. But I agree with @skierpage—it seems fine to exceed the W3C 64 character recommendation in this case.

#5 @peterhartree
5 weeks ago

  • Focuses accessibility added

Seems like the status quo is especially bad for editors who rely on screen readers—it could slow them down a bunch.

This ticket was mentioned in Slack in #accessibility by ryokuhi. View the logs.

5 weeks ago

#7 @joedolson
5 weeks ago

After discussion in the Accessibility team bug scrub, we're going to consider this a bug. While the current title can be argued to meet the requirements of WCAG 2.4.2 (https://www.w3.org/WAI/WCAG21/Understanding/page-titled), by conveying the purpose of the page, it does not provide enough distinction to differentiate between multiple windows when those windows may be editing different posts.

It's a relatively minor issue, as it only impacts users working on multiple documents at once, but still an issue.

Noting that a final solution should probably include JS to monitor and react when the post title is changed in the editor.

#8 @alexstine
5 weeks ago

  • Milestone changed from Awaiting Review to 5.8
  • Owner set to alexstine
  • Status changed from new to accepted

This ticket was mentioned in Slack in #accessibility by ryokuhi. View the logs.

5 days ago

#10 @francina
5 days ago

  • Keywords needs-patch added

This ticket was mentioned in Slack in #core by lukecarbis. View the logs.

42 hours ago

#12 @lukecarbis
42 hours ago

  • Type changed from enhancement to defect (bug)

42 hours ago

Here is a first try on this ticket :)

#13 @audrasjb
42 hours ago

  • Keywords has-patch added; needs-patch removed

42 hours ago

Edge case: Result on a new Post without any Title for now

42 hours ago

Result for a custom post type

#14 @audrasjb
42 hours ago

  • Keywords has-screenshots added

The title should ideally be less than 64 characters in length.

Maybe I'm wrong but I think this "rule" is only relevant for search engine optimization. If so, I think we don't really care about the length of the title of an admin page, isn't it? 🙂

Last edited 41 hours ago by audrasjb (previous) (diff)

41 hours ago

Fix for Untitled.

#15 @alexstine
41 hours ago

I just added patch: https://core.trac.wordpress.org/attachment/ticket/52314/52314-2.diff

In this patch, I changed the "Untitled" text to read "Add POST_TYPE_HERE". E.g. for a page it will read "Add Page".

Maybe this would look better than just "Edit Untitled" until we implement dynamic title updates via JS?


Note: See TracTickets for help on using tickets.