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 !
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.