[wp-trac] [WordPress Trac] #60045: Change to add_new label displays wrong label for old post types

WordPress Trac noreply at wordpress.org
Mon Dec 11 11:48:29 UTC 2023


#60045: Change to add_new label displays wrong label for old post types
----------------------------+------------------------------
 Reporter:  smerriman       |       Owner:  (none)
     Type:  defect (bug)    |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Administration  |     Version:  6.4
 Severity:  normal          |  Resolution:
 Keywords:                  |     Focuses:  accessibility
----------------------------+------------------------------

Comment (by afercia):

 @smerriman thanks for your report.

 > I have always registered custom post types by setting add_new_item to
 'Add New MyPostType', and leaving add_new out of the array entirely

 The WordPress admin menu always used the `add_new` post type label and I'm
 not sure that can be changed without introducing problems. I'd think the
 fundamental issue here is that ''entirely omitting'' the `add_new` label
 makes WordPress use the default:


 {{{
 'add_new'                  => array( __( 'Add New Post' ), __( 'Add New
 Page' ) ),
 }}}

 While providing ''all'' the post type labels isn't strictly required, it
 is highly recommended.

 I do realize that, apparently, the ''omission'' of the `add_new` label is
 a case that hasn't been taken into account in #47125. However, I'd
 recommend to just add the `add_new` label to all your custom post types
 and specify the post type name in the strings, as that's the best practice
 WordPress now recommends.

 Alternatively, core should add a new fallback mechanism to check whether
 `add_new` is omitted and provide the old defaults if that's the case. I'd
 see such additional fallback as a bit overkill though. Cc @joedolson

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/60045#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list