Posts, Post Types: Add labels for post transformation messages.

Because the existing `post_updated_messages` filter can be modified dynamically based on post state, it's unreliable to use with REST API clients. Instead, these new labels give clients stateless equivalents.

Merges [43744] from the 5.0 branch to trunk.

Props earnjam.
Fixes #45101.

Built from https://develop.svn.wordpress.org/trunk@44110


git-svn-id: http://core.svn.wordpress.org/trunk@43940 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Gary Pendergast 2018-12-13 09:57:24 +00:00
parent 0f1544dabc
commit 25366bd41f
2 changed files with 40 additions and 25 deletions

View File

@ -1526,6 +1526,14 @@ function _post_type_meta_capabilities( $capabilities = null ) {
* - `items_list_navigation` - Label for the table pagination hidden heading. Default is 'Posts list navigation' / * - `items_list_navigation` - Label for the table pagination hidden heading. Default is 'Posts list navigation' /
* 'Pages list navigation'. * 'Pages list navigation'.
* - `items_list` - Label for the table hidden heading. Default is 'Posts list' / 'Pages list'. * - `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_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.'
* *
* Above, the first default value is for non-hierarchical post types (like posts) * Above, the first default value is for non-hierarchical post types (like posts)
* and the second one is for hierarchical post types (like pages). * and the second one is for hierarchical post types (like pages).
@ -1539,6 +1547,8 @@ function _post_type_meta_capabilities( $capabilities = null ) {
* `items_list_navigation`, and `items_list` labels. * `items_list_navigation`, and `items_list` labels.
* @since 4.6.0 Converted the `$post_type` parameter to accept a `WP_Post_Type` object. * @since 4.6.0 Converted the `$post_type` parameter to accept a `WP_Post_Type` object.
* @since 4.7.0 Added the `view_items` and `attributes` labels. * @since 4.7.0 Added the `view_items` and `attributes` labels.
* @since 5.0.0 Added the `item_published`, `item_published_privately`, `item_reverted_to_draft`,
* `item_scheduled`, and `item_updated` labels.
* *
* @access private * @access private
* *
@ -1547,30 +1557,35 @@ function _post_type_meta_capabilities( $capabilities = null ) {
*/ */
function get_post_type_labels( $post_type_object ) { function get_post_type_labels( $post_type_object ) {
$nohier_vs_hier_defaults = array( $nohier_vs_hier_defaults = array(
'name' => array( _x( 'Posts', 'post type general name' ), _x( 'Pages', 'post type general name' ) ), 'name' => array( _x( 'Posts', 'post type general name' ), _x( 'Pages', 'post type general name' ) ),
'singular_name' => array( _x( 'Post', 'post type singular name' ), _x( 'Page', 'post type singular name' ) ), 'singular_name' => array( _x( 'Post', 'post type singular name' ), _x( 'Page', 'post type singular name' ) ),
'add_new' => array( _x( 'Add New', 'post' ), _x( 'Add New', 'page' ) ), 'add_new' => array( _x( 'Add New', 'post' ), _x( 'Add New', 'page' ) ),
'add_new_item' => array( __( 'Add New Post' ), __( 'Add New Page' ) ), 'add_new_item' => array( __( 'Add New Post' ), __( 'Add New Page' ) ),
'edit_item' => array( __( 'Edit Post' ), __( 'Edit Page' ) ), 'edit_item' => array( __( 'Edit Post' ), __( 'Edit Page' ) ),
'new_item' => array( __( 'New Post' ), __( 'New Page' ) ), 'new_item' => array( __( 'New Post' ), __( 'New Page' ) ),
'view_item' => array( __( 'View Post' ), __( 'View Page' ) ), 'view_item' => array( __( 'View Post' ), __( 'View Page' ) ),
'view_items' => array( __( 'View Posts' ), __( 'View Pages' ) ), 'view_items' => array( __( 'View Posts' ), __( 'View Pages' ) ),
'search_items' => array( __( 'Search Posts' ), __( 'Search Pages' ) ), 'search_items' => array( __( 'Search Posts' ), __( 'Search Pages' ) ),
'not_found' => array( __( 'No posts found.' ), __( 'No pages found.' ) ), 'not_found' => array( __( 'No posts found.' ), __( 'No pages found.' ) ),
'not_found_in_trash' => array( __( 'No posts found in Trash.' ), __( 'No pages found in Trash.' ) ), 'not_found_in_trash' => array( __( 'No posts found in Trash.' ), __( 'No pages found in Trash.' ) ),
'parent_item_colon' => array( null, __( 'Parent Page:' ) ), 'parent_item_colon' => array( null, __( 'Parent Page:' ) ),
'all_items' => array( __( 'All Posts' ), __( 'All Pages' ) ), 'all_items' => array( __( 'All Posts' ), __( 'All Pages' ) ),
'archives' => array( __( 'Post Archives' ), __( 'Page Archives' ) ), 'archives' => array( __( 'Post Archives' ), __( 'Page Archives' ) ),
'attributes' => array( __( 'Post Attributes' ), __( 'Page Attributes' ) ), 'attributes' => array( __( 'Post Attributes' ), __( 'Page Attributes' ) ),
'insert_into_item' => array( __( 'Insert into post' ), __( 'Insert into page' ) ), 'insert_into_item' => array( __( 'Insert into post' ), __( 'Insert into page' ) ),
'uploaded_to_this_item' => array( __( 'Uploaded to this post' ), __( 'Uploaded to this page' ) ), 'uploaded_to_this_item' => array( __( 'Uploaded to this post' ), __( 'Uploaded to this page' ) ),
'featured_image' => array( _x( 'Featured Image', 'post' ), _x( 'Featured Image', 'page' ) ), 'featured_image' => array( _x( 'Featured Image', 'post' ), _x( 'Featured Image', 'page' ) ),
'set_featured_image' => array( _x( 'Set featured image', 'post' ), _x( 'Set featured image', 'page' ) ), 'set_featured_image' => array( _x( 'Set featured image', 'post' ), _x( 'Set featured image', 'page' ) ),
'remove_featured_image' => array( _x( 'Remove featured image', 'post' ), _x( 'Remove featured image', 'page' ) ), 'remove_featured_image' => array( _x( 'Remove featured image', 'post' ), _x( 'Remove featured image', 'page' ) ),
'use_featured_image' => array( _x( 'Use as featured image', 'post' ), _x( 'Use as featured image', 'page' ) ), 'use_featured_image' => array( _x( 'Use as featured image', 'post' ), _x( 'Use as featured image', 'page' ) ),
'filter_items_list' => array( __( 'Filter posts list' ), __( 'Filter pages list' ) ), 'filter_items_list' => array( __( 'Filter posts list' ), __( 'Filter pages list' ) ),
'items_list_navigation' => array( __( 'Posts list navigation' ), __( 'Pages list navigation' ) ), 'items_list_navigation' => array( __( 'Posts list navigation' ), __( 'Pages list navigation' ) ),
'items_list' => array( __( 'Posts list' ), __( 'Pages list' ) ), 'items_list' => array( __( 'Posts list' ), __( 'Pages list' ) ),
'item_published' => array( __( 'Post published.' ), __( 'Page published.' ) ),
'item_published_privately' => array( __( 'Post published privately.' ), __( 'Page published privately.' ) ),
'item_reverted_to_draft' => array( __( 'Post reverted to draft.' ), __( 'Page reverted to draft.' ) ),
'item_scheduled' => array( __( 'Post scheduled.' ), __( 'Page scheduled.' ) ),
'item_updated' => array( __( 'Post updated.' ), __( 'Page updated.' ) ),
); );
$nohier_vs_hier_defaults['menu_name'] = $nohier_vs_hier_defaults['name']; $nohier_vs_hier_defaults['menu_name'] = $nohier_vs_hier_defaults['name'];

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.1-alpha-44109'; $wp_version = '5.1-alpha-44110';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.