Make WordPress Core

Opened 5 years ago

Last modified 4 years ago

#50292 new enhancement

Change 'post updated' notification text to '[post type name] updated'

Reported by: ninetyninew's profile ninetyninew Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords: close
Focuses: Cc:

Description

When working with a custom post type if you update the post you get the notification "Post updated." - would this be better to show the post type name instead of post? It's more descriptive.

I have flagged 'updated' but I suspect there maybe more instances of this with other statuses.

Change History (5)

#1 @SergeyBiryukov
5 years ago

  • Component changed from General to Posts, Post Types
  • Keywords close added

Hi there, welcome to WordPress Trac! Thanks for the ticket.

As of WordPress 5.0, there is already an item_updated label added in [44110] / #45101 that can be specified when registering a post type.

#2 follow-ups: @ninetyninew
5 years ago

Okay, I think i've missed this - mostly due to using a post type generator website to get the code for registering a post type which is missing these new values.

I wonder if there is any appetite for an additional simpler function here which could be used instead of the standard label set to define the post type singular and plural name as opposed to the entire label set and then all these get populated for you - to save instances of this where some new label for a post type maybe added later you'd already have those populated correctly?

Last edited 5 years ago by ninetyninew (previous) (diff)

#3 in reply to: ↑ 2 ; follow-up: @deadpixl
4 years ago

Replying to ninetyninew:

I wonder if there is any appetite for an additional simpler function here which could be used instead of the standard label set to define the post type singular and plural name as opposed to the entire label set and then all these get populated for you - to save instances of this where some new label for a post type maybe added later you'd already have those populated correctly?

This makes a lot of sense to me. Why not just define the singular and plural words for a CPT and use the defaults for the rest of the message? If needed, more specific messages could be defined using the existing labels array.

@SergeyBiryukov The message on [44110] mentions that the new labels were added because of the REST API. Do these new labels get used for the classic editor? They don't seem to be working for me. e.g. I'm still seeing "Post updated." for my CPT even though $labels['item_updated'] is "Event updated." All my other labels are working.

#4 in reply to: ↑ 2 @SergeyBiryukov
4 years ago

Replying to ninetyninew:

I wonder if there is any appetite for an additional simpler function here which could be used instead of the standard label set to define the post type singular and plural name as opposed to the entire label set and then all these get populated for you - to save instances of this where some new label for a post type maybe added later you'd already have those populated correctly?

Unfortunately, just inserting a post type name into a generic string like %s updated is not translatable, hence the need for a full array of various labels.

A general best practice in WordPress is to avoid post type and taxonomy names in generic strings due to i18n concerns and structural differences in languages. For reference, see:

#5 in reply to: ↑ 3 @SergeyBiryukov
4 years ago

Replying to deadpixl:

The message on [44110] mentions that the new labels were added because of the REST API. Do these new labels get used for the classic editor? They don't seem to be working for me. e.g. I'm still seeing "Post updated." for my CPT even though $labels['item_updated'] is "Event updated." All my other labels are working.

As far as I remember, item_updated and the other four labels added in [44110] are indeed only used in the block editor. It might be a good idea to look into using them in the classic editor too.

Note: See TracTickets for help on using tickets.