Support

Account

Home Forums Gutenberg Post Featured image in acf block

Helping

Post Featured image in acf block

  • 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)

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.