Hi
in my acf block
am doing this
<?php echo get_the_post_thumbnail_url(); ?>
to get the url of featured image. but it shows blank.
tried this also
<?php echo $featured_img_url = wp_get_attachment_url(get_post_thumbnail_id()); ?>
Make sure to pass the post ID to get_the_post_thumbnail_url()
In a block you can simply reference $post_id
to get it.
get_the_post_thumbnail_url($post_id)