diff -r be944660c56a -r 3d72ae0968f4 wp/wp-includes/theme-templates.php --- a/wp/wp-includes/theme-templates.php Wed Sep 21 18:19:35 2022 +0200 +++ b/wp/wp-includes/theme-templates.php Tue Sep 27 16:37:53 2022 +0200 @@ -1,6 +1,37 @@ post_status ) { + return; + } + + if ( ! $post->post_name ) { + wp_update_post( + array( + 'ID' => $post_id, + 'post_name' => 'custom_slug_' . uniqid(), + ) + ); + } + + $terms = get_the_terms( $post_id, 'wp_theme' ); + if ( ! is_array( $terms ) || ! count( $terms ) ) { + wp_set_post_terms( $post_id, wp_get_theme()->get_stylesheet(), 'wp_theme' ); + } +} + +/** * Generates a unique slug for templates. * * @access private @@ -14,7 +45,7 @@ * @return string The original, desired slug. */ function wp_filter_wp_template_unique_post_slug( $override_slug, $slug, $post_ID, $post_status, $post_type ) { - if ( 'wp_template' !== $post_type ) { + if ( 'wp_template' !== $post_type && 'wp_template_part' !== $post_type ) { return $override_slug; } @@ -68,14 +99,12 @@ } /** - * Print the skip-link script & styles. + * Prints the skip-link script & styles. * * @access private * @since 5.8.0 * * @global string $_wp_current_template_content - * - * @return void */ function the_block_template_skip_link() { global $_wp_current_template_content; @@ -135,7 +164,7 @@