Setting $post_type_object->template
seems to be done on ‘init’ (or close to it) while is_front_page()
is set later, so I had to use $_GET['post']
instead. I also changed get_post_type_object( 'post' )
to ‘page’. Like this:
add_action( 'init', 'home_block_template' );
function home_block_template() {
if ( ! is_admin() || ! isset( $_GET['post'] ) || get_option( 'page_on_front' ) !== $_GET['post'] ) {
return false;
}
$post_type_object = get_post_type_object( 'page' );
$post_type_object->template = array(
array( 'core/list' ),
);
}