Skip to content

Maybe tags panel using hardcoded "tags" string instead of tags taxonomy name label #22588

@lakrisgubben

Description

@lakrisgubben

Describe the bug
If I'd like to change the name of tags to for example "keywords" in the admin area/editor it's quite easy to do using the taxonomy_labels_post_tag filter. This works everywhere in both Gutenberg (in the sidebar it say "Keywords" and "Add new keyword") and the admin area except for in the maybe tags panel in the post publish panel where "tags" are hardcoded in two strings.

To reproduce
Steps to reproduce the behavior:

  1. Add something like the following to a plugin or your themes functions.php file.
add_filter(
	'taxonomy_labels_post_tag',
	function( object $labels ): object {
		$singular_name = 'Keyword';
		$plural_name   = 'Keywords';
		return (object) [
			'name'                  => $plural_name,
			'singular_name'         => $singular_name,
			'menu_name'             => $plural_name,
			'all_items'             => "All {$plural_name}",
			'new_item_name'         => "New {$singular_name} Name",
			'add_new_item'          => "Add New {$singular_name}",
			'edit_item'             => "Edit {$singular_name}",
			'update_item'           => "Update {$singular_name}",
			'view_item'             => "View {$singular_name}",
			'add_or_remove_items'   => "Add or remove {$plural_name}",
			'search_items'          => "Search {$plural_name}",
			'not_found'             => "No {$plural_name} found",
			'no_terms'              => "No {$plural_name}",
			'items_list'            => "{$plural_name} list",
			'items_list_navigation' => "{$plural_name} list navigation",
		];
	}
);
  1. Create a new post using Gutenberg.
  2. See that "tags" are changed to "keywords" in the sidebar.
  3. Don't add any tags/keywords before clicking on publish (and make sure to have the post publish panel activated). See that it says "Add tags" and "Tags help users and search engines..." instead of "Add keywords" etc.

Expected behavior
I'd except the maybe tags panel to use the name of the tags taxonomy from the label called "name".

I realise that this is probably very edge-casey, but happy to try and make a PR if y'all deem it worthwhile. :)

Screenshots
Screenshot 2020-05-24 at 18 38 54
"Keywords" in the sidebar.
Screenshot 2020-05-24 at 19 35 26
"Tags" in the post publish panel (but it says keywords in the input field since that uses the label)

Editor version (please complete the following information):

  • WordPress version: 5.5-alpha-47853
  • Does the website has Gutenberg plugin installed, or is it using the block editor that comes by default? Gutenberg plugin
  • If the Gutenberg plugin is installed, which version is it? Master

Metadata

Metadata

Assignees

No one assigned

    Labels

    General InterfaceParts of the UI which don't fall neatly under other labels.Good First IssueAn issue that's suitable for someone looking to contribute for the first time[Priority] LowUsed to indicate that the issue at hand isn't a top priority to address and can be handled later[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions