Home Forums Gutenberg Calling a Reusable ACF Block in a Block Template


Calling a Reusable ACF Block in a Block Template

  • Hi All,
    I’ve created a simple ACF block for a call to action and have saved a reusable version of it in Gutenberg. From there, I want that reusable block to automatically be added to every new post created.

    After doing some research, I implemented the following code:

    // Add Default Blocks Where Needed
    function ovyvo_register_template() {
        $post_type_object = get_post_type_object( 'post' );
        $post_type_object->template = array(
    			'acf/ovyvo-cta-noimage', array(
    				'ref' => 290,// Reusable block id
    add_action( 'init', 'ovyvo_register_template' );

    Notice I’m using the ID of the reusable block (290). However, whenever I add a new post, I just get a blank version of the block. The following error comes up in the console:

    Uncaught TypeError: can’t access property “buttons”, n is undefined – acf-input.min.js:4:8414

    I’m assuming this means it can’t access the content? I previously had the block restricted to specific post types, but have removed that. I should also note that adding the reusable block within Gutenberg works just fine – it’s just getting it added via this template.

    Any suggestions as to what else may cause this?


Viewing 1 post (of 1 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.