Support

Account

Home Forums Gutenberg WP 6.8 Gutenberg blocks won’t register

Solving

WP 6.8 Gutenberg blocks won’t register

  • Hi,

    I’m just testing the WP 6.8 update and noticed the following error:

    
    acf-pro-blocks.min.js?lfr=Ni40LjAuMQ%3D%3D:1 Uncaught TypeError: Cannot read properties of undefined (reading 'attributes')
        at E (acf-pro-blocks.min.js?lfr=Ni40LjAuMQ%3D%3D:1:25129)
        at Array.map (<anonymous>)
        at acf-pro-blocks.min.js?lfr=Ni40LjAuMQ%3D%3D:1:40591
        at o (acf.min.js?lfr=Ni40LjAuMQ%3D%3D:1:1403)
        at Object.doAction (acf.min.js?lfr=Ni40LjAuMQ%3D%3D:1:573)
        at n.doAction (acf.min.js?lfr=Ni40LjAuMQ%3D%3D:1:14776)
        at post-new.php?post_type=page:2472:5
    

    This is coming from this bit of code:

    
    const u = wp.blocks.registerBlockType(t.name, t);
    return u.attributes.anchor && (u.attributes.anchor = {
      type: "string"
    }),
    

    registerBlockType has a return type of

    WPBlockType | undefined: The block, if it has been successfully registered; otherwise undefined

    Seems like something changed in 6.8 making the block registration fail in JS.
    None of my custom blocks are registered after the update. I’m using the latest ACF PRO version (6.4)

  • Yes, I’ve got the same error!
    This happens on ACF blocks where the (core) anchor attribute is not even set?
    Downgrading to WordPress 6.7.2 is the only way to fix it.

  • This is unrelated to the anchor attribute itself. The registerBlockType function/method fails and returns undefined. After that, accessing attributes throws an error because it’s undefined. Without a deep dive my guess is creating the block structure in JS is not correct anymore.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.