Dynamic Block Types

The Dynamic Block Types module allows you to register and manage ACF Block Types from your WordPress admin, in ACF > Block Types menu.

All ACF settings can be set within the UI. See ACF Block Types documentation.

Export/Import Block Types

It is possible to export and import Block Types in a Json file using the ACF > Tools menu. Block Types can also be exported in PHP format, to manually register them in the functions.php file. Those tools are also available directly within the Dynamic Block Types UI.

Settings in PHP

The Dynamic Block Types UI use the acf_register_block_type() function behind the scene. It is possible to change the settings in PHP using the acf/register_block_type_args hook. See documentation. Usage example:

/*
 * acf/register_block_type_args
 * 
 * https://www.advancedcustomfields.com/resources/acf-register_block_type_args/
 */
add_filter('acf/register_block_type_args', 'my_acf_register_block_type_args');
function my_acf_register_block_type_args($args){
    
    if($args['name'] !== 'acf/my-block-type')
        return $args;
    
    $args['render_template'] = '';
    $args['render_callback'] = 'my_render_callback';
    
    return $args;
    
}

Disable the module

This module is enabled by default. To disable it, you can use the following code:

add_action('acf/init', 'my_acfe_modules');
function my_acfe_modules(){

    // Disable Dynamic Block Types
    acfe_update_setting('modules/dynamic_block_types', false);
    
    // Or:
    acf_update_setting('acfe/modules/dynamic_block_types', false);
    
}