From 5d05653b2f2b8d969d98226a60ec1707e4f786c7 Mon Sep 17 00:00:00 2001 From: hellofromTonya Date: Tue, 28 Feb 2023 15:07:23 +0000 Subject: [PATCH] Editor: Deprecate _resolve_home_block_template(). The internal Core-only `_resolve_home_block_template()` function was introduced in [53093] for a specific purpose of resolving the template for a site's home page. It was used as part of the Site Editor's redirect when the `postType` and `postId` query args were missing. The server-side handling was removed in [55338]. The function is no longer used in Core. This changeset deprecates the function and removes its tests. Follow-up to [55338], [53093]. Props johnbillion, hellofromTonya. Fixes #57716. Built from https://develop.svn.wordpress.org/trunk@55436 git-svn-id: http://core.svn.wordpress.org/trunk@54969 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/block-template.php | 32 ------------------------------ wp-includes/deprecated.php | 36 ++++++++++++++++++++++++++++++++++ wp-includes/version.php | 2 +- 3 files changed, 37 insertions(+), 33 deletions(-) diff --git a/wp-includes/block-template.php b/wp-includes/block-template.php index 9114e717eb..10434dacb1 100644 --- a/wp-includes/block-template.php +++ b/wp-includes/block-template.php @@ -335,35 +335,3 @@ function _resolve_template_for_new_post( $wp_query ) { $wp_query->set( 'post_status', 'auto-draft' ); } } - -/** - * Returns the correct template for the site's home page. - * - * @access private - * @since 6.0.0 - * - * @return array|null A template object, or null if none could be found. - */ -function _resolve_home_block_template() { - $show_on_front = get_option( 'show_on_front' ); - $front_page_id = get_option( 'page_on_front' ); - - if ( 'page' === $show_on_front && $front_page_id ) { - return array( - 'postType' => 'page', - 'postId' => $front_page_id, - ); - } - - $hierarchy = array( 'front-page', 'home', 'index' ); - $template = resolve_block_template( 'home', $hierarchy, '' ); - - if ( ! $template ) { - return null; - } - - return array( - 'postType' => 'wp_template', - 'postId' => $template->id, - ); -} diff --git a/wp-includes/deprecated.php b/wp-includes/deprecated.php index d8ca32ac9f..76f049df78 100644 --- a/wp-includes/deprecated.php +++ b/wp-includes/deprecated.php @@ -4591,3 +4591,39 @@ function get_page_by_title( $page_title, $output = OBJECT, $post_type = 'page' ) return null; } + +/** + * Returns the correct template for the site's home page. + * + * @access private + * @since 6.0.0 + * @deprecated 6.2.0 Site Editor's server-side redirect for missing postType and postId + * query args is removed. Thus, this function is no longer used. + * + * @return array|null A template object, or null if none could be found. + */ +function _resolve_home_block_template() { + _deprecated_function( __FUNCTION__, '6.2.0' ); + + $show_on_front = get_option( 'show_on_front' ); + $front_page_id = get_option( 'page_on_front' ); + + if ( 'page' === $show_on_front && $front_page_id ) { + return array( + 'postType' => 'page', + 'postId' => $front_page_id, + ); + } + + $hierarchy = array( 'front-page', 'home', 'index' ); + $template = resolve_block_template( 'home', $hierarchy, '' ); + + if ( ! $template ) { + return null; + } + + return array( + 'postType' => 'wp_template', + 'postId' => $template->id, + ); +} diff --git a/wp-includes/version.php b/wp-includes/version.php index 821c34131e..e9b08012b8 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.2-beta3-55435'; +$wp_version = '6.2-beta3-55436'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.