Make WordPress Core


Ignore:
Timestamp:
02/28/2023 03:05:50 PM (22 months ago)
Author:
hellofromTonya
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/deprecated.php

    r55365 r55436  
    45924592    return null;
    45934593}
     4594
     4595/**
     4596 * Returns the correct template for the site's home page.
     4597 *
     4598 * @access private
     4599 * @since 6.0.0
     4600 * @deprecated 6.2.0 Site Editor's server-side redirect for missing postType and postId
     4601 *                   query args is removed. Thus, this function is no longer used.
     4602 *
     4603 * @return array|null A template object, or null if none could be found.
     4604 */
     4605function _resolve_home_block_template() {
     4606    _deprecated_function( __FUNCTION__, '6.2.0' );
     4607
     4608    $show_on_front = get_option( 'show_on_front' );
     4609    $front_page_id = get_option( 'page_on_front' );
     4610
     4611    if ( 'page' === $show_on_front && $front_page_id ) {
     4612        return array(
     4613                'postType' => 'page',
     4614                'postId'   => $front_page_id,
     4615        );
     4616    }
     4617
     4618    $hierarchy = array( 'front-page', 'home', 'index' );
     4619    $template  = resolve_block_template( 'home', $hierarchy, '' );
     4620
     4621    if ( ! $template ) {
     4622        return null;
     4623    }
     4624
     4625    return array(
     4626            'postType' => 'wp_template',
     4627            'postId'   => $template->id,
     4628    );
     4629}
Note: See TracChangeset for help on using the changeset viewer.