Support

Account

Home Forums ACF PRO ACF6 + register_block_type + assets Reply To: ACF6 + register_block_type + assets

  • I’m having trouble too, I’ve tried the suggested stuff on wordpress.org which seems to be to use wp_register_script instead of wp_enqueue_script – the difference being that it registers it but doesnt load it. Then you call it within the block.json file referencing the handle see here

    So add your wp_register_script in a enqueue_block_editor_assets action eg.

    
    add_action( 'enqueue_block_editor_assets', function(){
    	wp_register_script( 'block-qb-daterange', get_template_directory_uri() . '/script-url-here.js', array(''), null, true );
    });
    

    then in block.json you can use script for global (front and admin) or editorScript key for just loading into the editor, basically anything on that link earlier

    
    {
        "script": "block-qb-daterange",
    }