Make WordPress Core


Ignore:
Timestamp:
02/28/2023 03:05:50 PM (3 years 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/block-template.php

    r55335 r55436  
    336336    }
    337337}
    338 
    339 /**
    340  * Returns the correct template for the site's home page.
    341  *
    342  * @access private
    343  * @since 6.0.0
    344  *
    345  * @return array|null A template object, or null if none could be found.
    346  */
    347 function _resolve_home_block_template() {
    348     $show_on_front = get_option( 'show_on_front' );
    349     $front_page_id = get_option( 'page_on_front' );
    350 
    351     if ( 'page' === $show_on_front && $front_page_id ) {
    352         return array(
    353             'postType' => 'page',
    354             'postId'   => $front_page_id,
    355         );
    356     }
    357 
    358     $hierarchy = array( 'front-page', 'home', 'index' );
    359     $template  = resolve_block_template( 'home', $hierarchy, '' );
    360 
    361     if ( ! $template ) {
    362         return null;
    363     }
    364 
    365     return array(
    366         'postType' => 'wp_template',
    367         'postId'   => $template->id,
    368     );
    369 }
Note: See TracChangeset for help on using the changeset viewer.