Title: get_post_type_labels
Published: April 25, 2014
Last modified: February 24, 2026

---

# get_post_type_labels( object|WP_Post_Type $post_type_object ): object

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/get_post_type_labels/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/functions/get_post_type_labels/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/get_post_type_labels/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/get_post_type_labels/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/functions/get_post_type_labels/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/functions/get_post_type_labels/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/get_post_type_labels/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/get_post_type_labels/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/functions/get_post_type_labels/?output_format=md#wp--skip-link--target)

This function’s access is marked private. This means it is not intended for use 
by plugin or theme developers, only by core. It is listed here for completeness.

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

## 󠀁[Description](https://developer.wordpress.org/reference/functions/get_post_type_labels/?output_format=md#description)󠁿

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

 * `name` – General name for the post type, usually plural. The same and overridden
   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` – Label for adding a new item. Default is ‘Add Post’ / ‘Add Page’.
 * `add_new_item` – Label for adding a new singular item. Default is ‘Add Post’ /‘
   Add Page’.
 * `edit_item` – Label for editing a singular item. Default is ‘Edit Post’ / ‘Edit
   Page’.
 * `new_item` – Label for the new item page title. Default is ‘New Post’ / ‘New 
   Page’.
 * `view_item` – Label for viewing a singular item. Default is ‘View Post’ / ‘View
   Page’.
 * `view_items` – Label for viewing post type archives. Default is ‘View Posts’ /‘
   View Pages’.
 * `search_items` – Label for searching plural items. Default is ‘Search Posts’ /‘
   Search Pages’.
 * `not_found` – Label used when no items are found. Default is ‘No posts found’/‘
   No pages found’.
 * `not_found_in_trash` – Label used when no items are in the Trash. Default is ‘
   No posts found in Trash’ / ‘No pages found in Trash’.
 * `parent_item_colon` – Label used to prefix parents of hierarchical items. Not
   used on non-hierarchical post types. Default is ‘Parent Page:’.
 * `all_items` – Label to signify all items in a submenu link. Default is ‘All Posts’/‘
   All Pages’.
 * `archives` – Label for archives in nav menus. Default is ‘Post Archives’ / ‘Page
   Archives’.
 * `attributes` – Label for the attributes meta box. Default is ‘Post Attributes’/‘
   Page Attributes’.
 * `insert_into_item` – Label for the media frame button. Default is ‘Insert into
   post’ / ‘Insert into page’.
 * `uploaded_to_this_item` – Label for the media frame filter. Default is ‘Uploaded
   to this post’ / ‘Uploaded to this page’.
 * `featured_image` – Label for the featured image meta box title. Default is ‘Featured
   image’.
 * `set_featured_image` – Label for setting the featured image. Default is ‘Set 
   featured image’.
 * `remove_featured_image` – Label for removing the featured image. Default is ‘
   Remove featured image’.
 * `use_featured_image` – Label in the media frame for using a featured image. Default
   is ‘Use as featured image’.
 * `menu_name` – Label for the menu name. Default is the same as `name`.
 * `filter_items_list` – Label for the table views hidden heading. Default is ‘Filter
   posts list’ / ‘Filter pages list’.
 * `filter_by_date` – Label for the date filter in list tables. Default is ‘Filter
   by date’.
 * `items_list_navigation` – Label for the table pagination hidden heading. Default
   is ‘Posts list navigation’ / ‘Pages list navigation’.
 * `items_list` – Label for the table hidden heading. Default is ‘Posts list’ / ‘
   Pages list’.
 * `item_published` – Label used when an item is published. Default is ‘Post published.’/‘
   Page published.’
 * `item_published_privately` – Label used when an item is published with private
   visibility.
   Default is ‘Post published privately.’ / ‘Page published privately.’
 * `item_reverted_to_draft` – Label used when an item is switched to a draft.
   Default
   is ‘Post reverted to draft.’ / ‘Page reverted to draft.’
 * `item_trashed` – Label used when an item is moved to Trash. Default is ‘Post 
   trashed.’ / ‘Page trashed.’
 * `item_scheduled` – Label used when an item is scheduled for publishing. Default
   is ‘Post scheduled.’ / ‘Page scheduled.’
 * `item_updated` – Label used when an item is updated. Default is ‘Post updated.’/‘
   Page updated.’
 * `item_link` – Title for a navigation link block variation. Default is ‘Post Link’/‘
   Page Link’.
 * `item_link_description` – Description for a navigation link block variation. 
   Default is ‘A link to a post.’ / ‘A link to a 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).

Note: To set labels used in post type admin notices, see the [‘post_updated_messages’](https://developer.wordpress.org/reference/hooks/post_updated_messages/)
filter.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/get_post_type_labels/?output_format=md#parameters)󠁿

 `$post_type_object`object|[WP_Post_Type](https://developer.wordpress.org/reference/classes/wp_post_type/)
required

Post type object.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/get_post_type_labels/?output_format=md#return)󠁿

 object Object with all the labels as member variables.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/get_post_type_labels/?output_format=md#source)󠁿

    ```php
    function get_post_type_labels( $post_type_object ) {
    	$nohier_vs_hier_defaults = WP_Post_Type::get_default_labels();

    	$nohier_vs_hier_defaults['menu_name'] = $nohier_vs_hier_defaults['name'];

    	$labels = _get_custom_object_labels( $post_type_object, $nohier_vs_hier_defaults );

    	if ( ! isset( $post_type_object->labels->template_name ) && isset( $post_type_object->labels->singular_name ) ) {
    			/* translators: %s: Post type name. */
    			$labels->template_name = sprintf( __( 'Single item: %s' ), $post_type_object->labels->singular_name );
    	}

    	$post_type = $post_type_object->name;

    	$default_labels = clone $labels;

    	/**
    	 * Filters the labels of a specific post type.
    	 *
    	 * The dynamic portion of the hook name, `$post_type`, refers to
    	 * the post type slug.
    	 *
    	 * Possible hook names include:
    	 *
    	 *  - `post_type_labels_post`
    	 *  - `post_type_labels_page`
    	 *  - `post_type_labels_attachment`
    	 *
    	 * @since 3.5.0
    	 *
    	 * @see get_post_type_labels() for the full list of labels.
    	 *
    	 * @param object $labels Object with labels for the post type as member variables.
    	 */
    	$labels = apply_filters( "post_type_labels_{$post_type}", $labels );

    	// Ensure that the filtered labels contain all required default values.
    	$labels = (object) array_merge( (array) $default_labels, (array) $labels );

    	return $labels;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/post.php#L2139)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/post.php#L2139-L2179)

## 󠀁[Hooks](https://developer.wordpress.org/reference/functions/get_post_type_labels/?output_format=md#hooks)󠁿

 [apply_filters( “post_type_labels_{$post_type}”, object $labels )](https://developer.wordpress.org/reference/hooks/post_type_labels_post_type/)

Filters the labels of a specific post type.

## 󠀁[Related](https://developer.wordpress.org/reference/functions/get_post_type_labels/?output_format=md#related)󠁿

| Uses | Description | 
| [WP_Post_Type::get_default_labels()](https://developer.wordpress.org/reference/classes/wp_post_type/get_default_labels/)`wp-includes/class-wp-post-type.php` |

Returns the default labels for post types.

  | 
| [_get_custom_object_labels()](https://developer.wordpress.org/reference/functions/_get_custom_object_labels/)`wp-includes/post.php` |

Builds an object with custom-something object (post type, taxonomy) labels out of a custom-something object

  | 
| [__()](https://developer.wordpress.org/reference/functions/__/)`wp-includes/l10n.php` |

Retrieves the translation of $text.

  | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  |

[Show 2 more](https://developer.wordpress.org/reference/functions/get_post_type_labels/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/get_post_type_labels/?output_format=md#)

| Used by | Description | 
| [WP_Post_Type::set_props()](https://developer.wordpress.org/reference/classes/wp_post_type/set_props/)`wp-includes/class-wp-post-type.php` |

Sets post type properties.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/get_post_type_labels/?output_format=md#changelog)󠁿

| Version | Description | 
| [6.7.0](https://developer.wordpress.org/reference/since/6.7.0/) | Restored pre-6.4.0 defaults for the `add_new` label and updated documentation.
 Updated core usage to reference `add_new_item`. | 
| [6.6.0](https://developer.wordpress.org/reference/since/6.6.0/) | Added the `template_name` label. | 
| [6.4.0](https://developer.wordpress.org/reference/since/6.4.0/) | Changed default values for the `add_new` label to include the type of content. This matches `add_new_item` and provides more context for better accessibility. | 
| [6.3.0](https://developer.wordpress.org/reference/since/6.3.0/) | Added the `item_trashed` label. | 
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Added the `item_link` and `item_link_description` labels. | 
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Added the `filter_by_date` label. | 
| [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | Added the `item_published`, `item_published_privately`, `item_reverted_to_draft`, `item_scheduled`, and `item_updated` labels. | 
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Added the `view_items` and `attributes` labels. | 
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Converted the `$post_type` parameter to accept a `WP_Post_Type` object. | 
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Added the `archives`, `insert_into_item`, `uploaded_to_this_item`, `filter_items_list`, `items_list_navigation`, and `items_list` labels. | 
| [4.3.0](https://developer.wordpress.org/reference/since/4.3.0/) | Added the `featured_image`, `set_featured_image`, `remove_featured_image`, and `use_featured_image` labels. | 
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |

[Show 7 more](https://developer.wordpress.org/reference/functions/get_post_type_labels/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/get_post_type_labels/?output_format=md#)

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/get_post_type_labels/?output_format=md#user-contributed-notes)󠁿

 1.  [Skip to note 2 content](https://developer.wordpress.org/reference/functions/get_post_type_labels/?output_format=md#comment-content-2211)
 2.   [Aurovrata Venet](https://profiles.wordpress.org/aurovrata/)  [  9 years ago  ](https://developer.wordpress.org/reference/functions/get_post_type_labels/#comment-2211)
 3. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_post_type_labels%2F%23comment-2211)
    Vote results for this note: 9[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_post_type_labels%2F%23comment-2211)
 4. To get a post type labels and other registered parameters, use the [`get_post_type_object()`](https://developer.wordpress.org/reference/functions/get_post_type_object/)
    function instead.
 5.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_post_type_labels%2F%3Freplytocom%3D2211%23feedback-editor-2211)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_post_type_labels%2F)
before being able to contribute a note or feedback.