Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/get post type labels

This function's access is marked as private. That means it is not intended for use by plugin and theme developers, but only in other core functions. It is listed here for completeness. Use get_post_type_object instead.


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 http://codex.wordpress.org/I18n_for_WordPress_Developers#Disambiguation_by_context 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).


<?php get_post_type_labels$post_type_object ); ?>


(object) (required)
Default: None

Return Values

object with all the labels as member variables


  • 'post_type_labels_{$post_type}' called on return object:
    apply_filters( 'post_type_labels_example_custom_post_type', $labels )

Change Log

Since: 3.0

Source File

get_post_type_labels() is located in wp-includes/post.php