_resolve_home_block_template

The timeline below displays how wordpress function _resolve_home_block_template has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.3

/**
 * 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);
}

WordPress Version: 6.2

/**
 * 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);
}

WordPress Version: 6.1

/**
 * 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);
}