Is it possible to pass a post field value to script in acf_register_block_type() using wp_localize_script()? Tried with plain get_field('field_key'), tried getting them with $post->ID (example below) and get_queried_object_id(), but none of them seem to work.
I know I can work around this by putting the values in data-attributes in the block template and reading them from there, but I’m wondering if it’s possible to pass them with wp_localize_script. There’s no mention about this in the documentation.
If that doesn’t work the post might not yet be available at the moment you call wp_localize_script. You should try changing what action you hook this function into. (Since you mention acf_register_block_type() I think you might be calling it directly from the template/render_callbak?)