Make WordPress Core

Opened 5 years ago

Last modified 3 years ago

#46614 assigned enhancement

Category/tag/taxonomy names on admin screens

Reported by: dianakc's profile Dianakc Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Administration Keywords: has-patch needs-refresh
Focuses: Cc:


Hello, I'd like to suggest that when browsing categories, tags any taxonomies in general the admin screen display the taxonomy title/name somewhere preferably at the very top as I see that newbie users feel confused when browsing posts from a specific category/tag/taxonomy.

When browsing the "Succulents" tag
When browsing the "Plants from Mexico" category

I also searched for some way to add this myself for some clients and can't find how to do so.

Thanks (sorry if this is out of scope/wrong place)

Attachments (1)

46614-category-tag-names.diff (486 bytes) - added by mikejdent 3 years ago.

Download all attachments as: .zip

Change History (6)

#1 follow-up: @sabernhardt
4 years ago

  • Keywords needs-patch added
  • Version 5.1 deleted

@Dianakc Hi and thanks for the ticket!

The heading text is rather strict in wp-admin/edit.php:

<h1 class="wp-heading-inline">
echo esc_html( $post_type_object->labels->name );

So in U.S. English it's always "Posts" for standard posts, "Pages" for the pages, and the main (plural) label for any custom post type.

It could be good to create a filter for customizing the heading text.

#2 in reply to: ↑ 1 @Dianakc
4 years ago

Sorry but you're confusing taxonomies with custom post types, the ticket is about the page titles, taxonomy pages should display the taxonomy they are showing, that's all.

#3 @sabernhardt
4 years ago

@Dianakc Sorry for the confusion. Mentioning the pages and custom post type names is not necessarily relevant.

But my point was that the headings for post listing screens always match the post type, even when the posts in that list are restricted to one category, tag or other taxonomy. Adding the selected taxonomy name there should require a patch to wp-admin/edit.php.

#4 @mikejdent
3 years ago

  • Keywords has-patch needs-testing added; needs-patch removed

Hi @Dianakc and @sabernhardt!

I think we should be able to do this by appending get_the_archive_title(); to the end of the heading. That way we can still see the Post Type, but also what taxonomy we are browsing. If there is no taxonomy (ie the top-level page) then it returns the word "Archives" which can then be filtered out.

Could probably do with some e2e to check I haven't missed any edge cases.

#5 @sabernhardt
3 years ago

  • Keywords needs-refresh added; needs-testing removed

@mikejdent Thanks for creating a patch! A few tips for next time:

  • Use classes instead of style attributes
  • Use spacing according to PHP coding standards
  • Pay attention to translation functions: __( 'Archives' ) instead of Archives

If the filter information does not need to be inside the heading, we could use the same <span class="subtitle"> that currently shows search queries after the Add New link.

If added inside the heading, the class could be reused there with a different margin in that context (and perhaps a small tag instead of span).

I am having some trouble with the archive title when using the date filter, at least on the Pages screen.

Note: See TracTickets for help on using tickets.