Support

Account

Home Forums Gutenberg Moving register_block_type out of functions.php Reply To: Moving register_block_type out of functions.php

  • Hi @samsmyth. From what I understand, the php file (template) for your block behave as a callback. And therefore is called only when the block is encountered or added to the Gutenberg Editor.

    This block has to be registered before it’s called…

    If you want to keep things apart, you can create a separate file “register-acf-blocks.php” then call it at the top of your function.php like this :

    
    /**
    * Include my file containing all my ACF Blocks Registrations
    */
    include( __DIR__ . '/includes/register-acf-blocks.php' );
    

    You can then, of course, store this file where you want in your project.

    Hope this helps.
    Best regards !