Support

Account

Home Forums Gutenberg ACF Blocks won't render when using register_block_template()

Solved

ACF Blocks won't render when using register_block_template()

  • Hi all, i’m trying to get an ACF block which is working fine across all Post Types and Templates to be the only Block loaded on posts (replacing the ‘Classic Block’), i’m using register_block_template() but can’t seem to include any of my ACF blocks in any templates, just give’s me a blank page with not editor rendered at all! Anyone else managed to do this?

    My code is below.

    // GUTENBERG BLOCK TEMPLATES
    function register_block_template() {
    
        //Posts
        $post_type_object_post = get_post_type_object( 'post' );
        $post_type_object_post->template = array(
            array( 'acf/editor' ),
        );
        // Lock Post Blocks
        //$post_type_object_post->template_lock = 'all';
    }
    add_action( 'init', 'register_block_template' );
  • Scrap that, I hadn’t added the Post Post Type to the Post Type array when registering the Block!

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

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.