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 | 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)
#2
follow-ups:
↓ 3
↓ 4
@
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?
#3
in reply to:
↑ 2
;
follow-up:
↓ 5
@
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
@
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
@
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.
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.