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()); ?>

    • apmeyer

    • December 25, 2019 at 12:39 pm

    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.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.