Skip to content

WP_Post_Type->template is not used in site editor #60710

@bacoords

Description

@bacoords

Description

The initial state of a new post type is defined in WP_Post_Type->template. This initial state is acknowledged by the block editor when creating a new post/page/etc but not in the site editor.

Step-by-step reproduction instructions

  1. Register a post type block template for a post type that appears in the site editor. We'll usepage (but you could use wp_block). Place this in a functions.php or plugin file:
function myplugin_register_template() {
    $post_type_object = get_post_type_object( 'page' );
    $post_type_object->template = array(
        array( 'core/image' ),
    );
}
add_action( 'init', 'myplugin_register_template' );
  1. Start a new page from the regular dashboard, which loads the block editor, and you'll see the initial block content (an image block) in the post content.
  2. Start a new page from inside the site editor - you'll see that there is no initial block content.

Screenshots, screen recording, code snippet

No response

Environment info

  • WordPress 6.5.2
  • Gutenberg 18.1.0

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Metadata

Metadata

Labels

[Feature] Site EditorRelated to the overarching Site Editor (formerly "full site editing")[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

Type

No type
No fields configured for issues without a type.

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions