Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patterns not working anymore as a post template #55846

Closed
renatho opened this issue Nov 3, 2023 · 2 comments · Fixed by #55858
Closed

Patterns not working anymore as a post template #55846

renatho opened this issue Nov 3, 2023 · 2 comments · Fixed by #55858
Assignees
Labels
[Status] In Progress Tracking issues with work in progress [Type] Regression Related to a regression in the latest release

Comments

@renatho
Copy link
Contributor

renatho commented Nov 3, 2023

Description

Pattern block as a post template is not working anymore on the latest versions of Gutenberg. If fires an error on the block editor load, and breaks the block.

We realized that while testing Sensei LMS plugin on WP 6.4 because some custom post types are now broken there. It's also reported in Automattic/sensei#7262 as part of one of the Sensei post types.

Step-by-step reproduction instructions

  1. Create a new post type with a template by using the following snippet:
    add_action( 'init', function() {
        register_post_type(
    	    'my-test',
    	    [
    		    'public'       => true,
    		    'show_in_rest' => true,
    		    'template'     => [
    			    [
    				    'core/pattern',
    				    [ 'slug' => 'core/simple-header-with-dark-background' ],
    			    ],
    		    ]
    	    ]
        );
    } );
  2. Create a new post of this new post type.
  3. See the error in the editor.
  4. Open the browser console and see the JS error.

Screenshots, screen recording, code snippet

Screenshot 2023-11-01 at 11 48 33

Environment info

  • Tested on WP 6.4 RC2 or with Gutenberg plugin activated version 17.0.0-rc.1.
  • Reproduced on Chrome and Firefox.

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

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Nov 3, 2023
@hellofromtonya hellofromtonya added [Type] Breaking Change For PRs that introduce a change that will break existing functionality [Type] Regression Related to a regression in the latest release and removed [Type] Breaking Change For PRs that introduce a change that will break existing functionality labels Nov 4, 2023
@hellofromtonya
Copy link
Contributor

hellofromtonya commented Nov 4, 2023

6.4.0 candidate - this issue appears to be a regression or BC break, given it worked prior to 6.4.

If the ability was removed, then it's a BC break; else, it's a regression.

Pinging 6.4 editor leads @annezazu @bph @karmatosed @mikachan @SiobhyB.

Also pinged in Make/Core slack's #core-editor channel.

@Rajinsharwar
Copy link
Contributor

Rajinsharwar commented Nov 4, 2023

Hey @hellofromtonya, this does seem to be an issue.

On WP 6.4, the issue occurs when you register any custom post with the template set to patterns. 🐞

On WP 6.3.2, the issue doesn't seem to occur even when the patterns are being used in the templates. ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] In Progress Tracking issues with work in progress [Type] Regression Related to a regression in the latest release
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants