Last active
May 24, 2024 07:03
-
-
Save mclarenmervin/e7e073ad05d7a30306778a8582bf5d30 to your computer and use it in GitHub Desktop.
ACF Image URL by Image ID
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// first, get the image ID returned by ACF | |
$image_id = get_field('image_field'); | |
$image_size = 'thumbnail'; | |
$image_array = wp_get_attachment_image_src($image_id, $image_size); | |
$image_url = $image_array[0]; | |
?> | |
<img src="<?php echo $image_url; ?>" alt=""> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment