Builds an object with all post type labels out of a post type object

Accepted keys of the label array in the post type object:

  • name - general name for the post type, usually plural. The same and overriden by $post_type_object->label. Default is Posts/Pages
  • singular_name - name for one object of this post type. Default is Post/Page
  • add_new - Default is Add New for both hierarchical and non-hierarchical types. When internationalizing this string, please use a {@link gettext context} matching your post type. Example: _x('Add New', 'product');
  • add_new_item - Default is Add New Post/Add New Page
  • edit_item - Default is Edit Post/Edit Page
  • new_item - Default is New Post/New Page
  • view_item - Default is View Post/View Page
  • search_items - Default is Search Posts/Search Pages
  • not_found - Default is No posts found/No pages found
  • not_found_in_trash - Default is No posts found in Trash/No pages found in Trash
  • parent_item_colon - This string isn't used on non-hierarchical types. In hierarchical ones the default is Parent Page:

Above, the first default value is for non-hierarchical post types (like posts) and the second one is for hierarchical post types (like pages).

get_post_type_labels() 描述


<?php get_post_type_labels$post_type_object ); ?>

get_post_type_labels() 用法



(object) (必填)

默认值: None

get_post_type_labels() 参数



object with all the labels as member variables

get_post_type_labels() 返回值


添加于 版本: 3.0

get_post_type_labels() 历史