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

Reusable Block in template becomes invalid after save #15542

Closed
koolkatwebdesigns opened this issue May 9, 2019 · 2 comments
Closed

Reusable Block in template becomes invalid after save #15542

koolkatwebdesigns opened this issue May 9, 2019 · 2 comments
Labels
[Block] Block The "Reusable Block" Block [Feature] Templates API Related to API powering block template functionality in the Site Editor

Comments

@koolkatwebdesigns
Copy link

Describe the bug
A reusable block added via a template appears fine at first but becomes invalid after save

To reproduce
Steps to reproduce the behavior:
1.Add a reusable block to a template as follows:
‘template’ => array(
array( ‘core/block’, array(
‘ref’ => ‘547’,
) ),
2. In the dashboard, create a new instance of a custom post type via "add new"
3. Notice the reusable block appears in the editor.
4. Preview the post and notice the usable block appears in the front end
5. save the post as a draft or publish
6. Refresh the browser
7. Notice the reusable block is no longer present and is replaced by the message:
"Block has been deleted or is unavailable."

Note: The reusable block can still be manually added to the post and will work fine.
Screen shot
Screenshot 2019-05-09 09 34 02

Expected behavior
The reusable block should be saved with the post and re-appear

Desktop (please complete the following information):

  • OS: MAC OS
  • Browser: chrome
  • Version: 74.0.3729.131

Additional context
I am using WordPress 5.2

@swissspidy swissspidy added [Block] Block The "Reusable Block" Block Needs Testing Needs further testing to be confirmed. [Feature] Templates API Related to API powering block template functionality in the Site Editor labels May 23, 2019
@noisysocks
Copy link
Member

This works when I try it in the latest Gutenberg.

template

I used this CPT to test:

function myplugin_register_book_post_type() {
    $args = array(
        'public' => true,
        'label'  => 'Books',
        'show_in_rest' => true,
        'template' => array(
            array( 'core/block', array(
                'ref' => 30,
            ) ),
        ),
    );
    register_post_type( 'book', $args );
}
add_action( 'init', 'myplugin_register_book_post_type' );

Possibly was fixed by #14367.

@noisysocks noisysocks removed the Needs Testing Needs further testing to be confirmed. label Oct 31, 2019
@koolkatwebdesigns
Copy link
Author

I am still seeing this issue in WP 5.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Block The "Reusable Block" Block [Feature] Templates API Related to API powering block template functionality in the Site Editor
Projects
None yet
Development

No branches or pull requests

3 participants