Advanced UsageFREE

Docs Modules Block Types Advanced Usage

#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.

#Exisiting Block Type

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
 */
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'){
    
        $args['render_template'] = '';
        $args['render_callback'] = 'my_render_callback';
    
    }
    
    return $args;
    
}