Skip to content

Use labels in getVisualTypeName() #71492

Closed

Description

@dannyreaktiv

What problem does this address?

function getVisualTypeName( suggestion ) {

In the getVisualTypeName() function, the results are usually going to be the slugs for the post types, rather than all nice human readable labels from the Post Type Objects.

What is your proposed solution?

Is there a way for the getVisualTypeName() to extract and return the single label from the Post Type Object? Does it come along in the suggestion?

Activity

  1. t-hamano commented on Sep 4, 2025

    @t-hamano
    Contributor

    Thanks for the suggestion.

    I think the getVisualTypeName() function itself should be completely refactored. Each strings are hardcoded, so it can't be localized.

    The text-transform: capitalize should be removed as well:

    .components-menu-item__shortcut {
    color: $gray-700;
    text-transform: capitalize;
    white-space: nowrap; // tags shouldn't go over two lines.
    }

  2. Adi-ty commented on Sep 4, 2025

    @Adi-ty
    Contributor

    Custom post types would need a separate core WordPress ticket to add type_label to the /wp/v2/search REST API response.

  3. added a commit that references this issue on Sep 4, 2025
    4a15b46
  4. added a commit that references this issue on Sep 10, 2025
    c4d5fa4
  5. added a commit that references this issue on Sep 10, 2025
    c7a21f6
  6. added a commit that references this issue on Sep 11, 2025
    cb6a5a5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

[Feature] Link EditingLink components (LinkControl, URLInput) and integrations (RichText link formatting)[Package] Block editor/packages/block-editor[Status] In ProgressTracking issues with work in progress[Type] EnhancementA suggestion for improvement.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions