[wp-trac] [WordPress Trac] #50438: item_ labels do not work once registered in a post type

WordPress Trac noreply at wordpress.org
Sat Jun 20 09:38:42 UTC 2020


#50438: item_ labels do not work once registered in a post type
--------------------------+-----------------------------
 Reporter:  ninetyninew   |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Labels starting with prefix item_ from here:

 https://developer.wordpress.org/reference/functions/get_post_type_labels/

 Are not used in the dashboard when registering them in a custom post type.

 {{{#!php
 <?php
 $labels = array(
         'name'                          => _x( 'Cars', 'Post Type General
 Name', 'abcde' ),
         'singular_name'                 => _x( 'Car', 'Post Type Singular
 Name', 'abcde' ),
         'menu_name'                     => __( 'Cars', 'abcde' ),
         'name_admin_bar'                => __( 'Car', 'abcde' ),
         'archives'                      => __( 'Car Archives', 'abcde' ),
         'attributes'                    => __( 'Car Attributes', 'abcde'
 ),
         'parent_item_colon'             => __( 'Parent Car:', 'abcde' ),
         'all_items'                     => __( 'All Cars', 'abcde' ),
         'add_new_item'                  => __( 'Add New Car', 'abcde' ),
         'add_new'                       => __( 'Add New', 'abcde' ),
         'new_item'                      => __( 'New Car', 'abcde' ),
         'edit_item'                     => __( 'Edit Car', 'abcde' ),
         'update_item'                   => __( 'Update Car', 'abcde' ),
         'view_item'                     => __( 'View Car', 'abcde' ),
         'view_items'                    => __( 'View Cars', 'abcde' ),
         'search_items'                  => __( 'Search Car', 'abcde' ),
         'not_found'                     => __( 'Not found', 'abcde' ),
         'not_found_in_trash'            => __( 'Not found in Trash',
 'abcde' ),
         'featured_image'                => __( 'Initial Image', 'abcde' ),
         'set_featured_image'            => __( 'Set initial image',
 'abcde' ),
         'remove_featured_image'         => __( 'Remove initial image',
 'abcde' ),
         'use_featured_image'            => __( 'Use as initial image',
 'abcde' ),
         'insert_into_item'              => __( 'Insert into Car', 'abcde'
 ),
         'uploaded_to_this_item'         => __( 'Uploaded to this Car',
 'abcde' ),
         'items_list'                    => __( 'Cars list', 'abcde' ),
         'items_list_navigation'         => __( 'Cars list navigation',
 'abcde' ),
         'filter_items_list'             => __( 'Filter Cars list', 'abcde'
 ),
         'item_published'                        => __( 'Car published',
 'abcde' ),
         'item_published_privately'      => __( 'Car published privately',
 'abcde' ),
         'item_reverted_to_draft'        => __( 'Car reverted to draft',
 'abcde' ),
         'item_scheduled'                        => __( 'Car scheduled',
 'abcde' ),
         'item_updated'                          => __( 'Car updated',
 'abcde' ),
 );
 $capabilities = array(
         'edit_post'          => 'update_core',
         'read_post'          => 'update_core',
         'delete_post'        => 'update_core',
         'edit_posts'         => 'update_core',
         'edit_others_posts'  => 'update_core',
         'delete_posts'       => 'update_core',
         'publish_posts'      => 'update_core',
         'read_private_posts' => 'update_core'
 );
 $args = array(
         'label'                 => __( 'Car', 'abcde' ),
         'description'           => __( 'Post Type Description', 'abcde' ),
         'labels'                => $labels,
         'supports'              => array( 'title', 'thumbnail' ),
         'hierarchical'          => false,
         'public'                => false,
         'show_ui'               => true,
         'show_in_menu'          => true,
         'menu_position'         => 40,
         'menu_icon'             => 'dashicons-businessman',
         'show_in_admin_bar'     => true,
         'show_in_nav_menus'     => false,
         'can_export'            => true,
         'has_archive'           => false,
         'exclude_from_search'   => true,
         'publicly_queryable'    => false,
         'rewrite'               => false,
         'capabilities'          => $capabilities,
         'show_in_rest'          => false,
 );
 register_post_type( 'abcde_car', $args );
 }}}

 e.g. on post update the notice is Post updated. Not Car updated.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/50438>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list