It’s already in the docs. Try this:
<?php
$image = get_field('image');
if( !empty($image) ): ?>
<img src="https://wordpress.stackexchange.com/questions/223867/<?php echo $image["url']; ?>" alt="https://wordpress.stackexchange.com/questions/223867/<?php echo $image["alt']; ?>" />
<?php endif; ?>
For easier debugging, try this: var_dump($image);
to print out the $image
variable to know what is in $image
. You can also put var_dump($image)
inside <pre>
tag for better reading.