diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php index b0967dbad82ba..2f7cba613f0ed 100644 --- a/src/wp-includes/post.php +++ b/src/wp-includes/post.php @@ -2083,6 +2083,7 @@ function _post_type_meta_capabilities( $capabilities = null ) { * @since 6.3.0 Added the `item_trashed` label. * @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. + * @since 6.6.0 Added the `template_name` label. * * @access private * @@ -2096,6 +2097,11 @@ function get_post_type_labels( $post_type_object ) { $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; diff --git a/src/wp-includes/taxonomy.php b/src/wp-includes/taxonomy.php index 5f5f9bf0893be..693ab1b84d447 100644 --- a/src/wp-includes/taxonomy.php +++ b/src/wp-includes/taxonomy.php @@ -645,6 +645,7 @@ function unregister_taxonomy( $taxonomy ) { * @since 5.8.0 Added the `item_link` and `item_link_description` labels. * @since 5.9.0 Added the `name_field_description`, `slug_field_description`, * `parent_field_description`, and `desc_field_description` labels. + * @since 6.6.0 Added the `template_name` label. * * @param WP_Taxonomy $tax Taxonomy object. * @return object { @@ -679,6 +680,7 @@ function unregister_taxonomy( $taxonomy ) { * @type string $update_item Default 'Update Tag'/'Update Category'. * @type string $add_new_item Default 'Add New Tag'/'Add New Category'. * @type string $new_item_name Default 'New Tag Name'/'New Category Name'. + * @type string $template_name Default 'Tag Archives'/'Category Archives'. * @type string $separate_items_with_commas This label is only used for non-hierarchical taxonomies. Default * 'Separate tags with commas', used in the meta box. * @type string $add_or_remove_items This label is only used for non-hierarchical taxonomies. Default @@ -719,6 +721,11 @@ function get_taxonomy_labels( $tax ) { $labels = _get_custom_object_labels( $tax, $nohier_vs_hier_defaults ); + if ( ! isset( $tax->labels->template_name ) && isset( $labels->singular_name ) ) { + /* translators: %s: Taxonomy name. */ + $labels->template_name = sprintf( _x( '%s Archives', 'taxonomy template name' ), $labels->singular_name ); + } + $taxonomy = $tax->name; $default_labels = clone $labels;