diff -r 7b1b88e27a20 -r 48c4eec2b7e6 wp/wp-includes/theme-templates.php --- a/wp/wp-includes/theme-templates.php Thu Sep 29 08:06:27 2022 +0200 +++ b/wp/wp-includes/theme-templates.php Fri Sep 05 18:40:08 2025 +0200 @@ -27,7 +27,7 @@ $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' ); + wp_set_post_terms( $post_id, get_stylesheet(), 'wp_theme' ); } } @@ -39,12 +39,12 @@ * * @param string $override_slug The filtered value of the slug (starts as `null` from apply_filter). * @param string $slug The original/un-filtered slug (post_name). - * @param int $post_ID Post ID. + * @param int $post_id Post ID. * @param string $post_status No uniqueness checks are made if the post is still draft or pending. * @param string $post_type Post type. * @return string The original, desired slug. */ -function wp_filter_wp_template_unique_post_slug( $override_slug, $slug, $post_ID, $post_status, $post_type ) { +function wp_filter_wp_template_unique_post_slug( $override_slug, $slug, $post_id, $post_status, $post_type ) { if ( 'wp_template' !== $post_type && 'wp_template_part' !== $post_type ) { return $override_slug; } @@ -60,8 +60,8 @@ * in the case of new entities since is too early in the process to have been saved * to the entity. So for now we use the currently activated theme for creation. */ - $theme = wp_get_theme()->get_stylesheet(); - $terms = get_the_terms( $post_ID, 'wp_theme' ); + $theme = get_stylesheet(); + $terms = get_the_terms( $post_id, 'wp_theme' ); if ( $terms && ! is_wp_error( $terms ) ) { $theme = $terms[0]->name; } @@ -71,7 +71,7 @@ 'post_type' => $post_type, 'posts_per_page' => 1, 'no_found_rows' => true, - 'post__not_in' => array( $post_ID ), + 'post__not_in' => array( $post_id ), 'tax_query' => array( array( 'taxonomy' => 'wp_theme', @@ -90,7 +90,7 @@ $alt_post_name = _truncate_post_slug( $override_slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix"; $query_args['post_name__in'] = array( $alt_post_name ); $query = new WP_Query( $query_args ); - $suffix++; + ++$suffix; } while ( count( $query->posts ) > 0 ); $override_slug = $alt_post_name; } @@ -99,16 +99,22 @@ } /** - * Prints the skip-link script & styles. + * Enqueues the skip-link script & styles. * * @access private - * @since 5.8.0 + * @since 6.4.0 * * @global string $_wp_current_template_content */ -function the_block_template_skip_link() { +function wp_enqueue_block_template_skip_link() { global $_wp_current_template_content; + // Back-compat for plugins that disable functionality by unhooking this action. + if ( ! has_action( 'wp_footer', 'the_block_template_skip_link' ) ) { + return; + } + remove_action( 'wp_footer', 'the_block_template_skip_link' ); + // Early exit if not a block theme. if ( ! current_theme_supports( 'block-templates' ) ) { return; @@ -118,14 +124,8 @@ if ( ! $_wp_current_template_content ) { return; } - ?> - - - true ) ); + wp_add_inline_script( $script_handle, $skip_link_script ); + wp_enqueue_script( $script_handle ); } /** @@ -209,7 +225,7 @@ * @since 5.8.0 */ function wp_enable_block_templates() { - if ( wp_is_block_theme() || WP_Theme_JSON_Resolver::theme_has_support() ) { + if ( wp_is_block_theme() || wp_theme_has_theme_json() ) { add_theme_support( 'block-templates' ); } }