Make WordPress Core


Ignore:
Timestamp:
10/03/2024 10:44:30 PM (15 months ago)
Author:
joedolson
Message:

Administration: Switch core post type labels to add_new_item.

In [56515], the default value of Add New was changed to "Add New Post / Add New Page". This caused problems with post types where add_new was not declared.

Change core usage to reference the add_new_item value and revert the default value of add_new back to "Add New / Add New". This retains the accessibility advantages without creating counter intuitive usage of the add_new key.

With this change, post types registered with no add_new key will be unimpacted in core, and post types registered with no add_new_item key will use the default "Add New Post", which is not a change from the current state.

Props smerriman, afercia, rcreators, joedolson, eclev91, johnbillion.
Fixes #60045.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/edit.php

    r58419 r59161  
    420420<?php
    421421if ( current_user_can( $post_type_object->cap->create_posts ) ) {
    422     echo ' <a href="' . esc_url( admin_url( $post_new_file ) ) . '" class="page-title-action">' . esc_html( $post_type_object->labels->add_new ) . '</a>';
     422    echo ' <a href="' . esc_url( admin_url( $post_new_file ) ) . '" class="page-title-action">' . esc_html( $post_type_object->labels->add_new_item ) . '</a>';
    423423}
    424424
Note: See TracChangeset for help on using the changeset viewer.