V
V
Vladimir2021-10-21 14:46:53
WordPress
Vladimir, 2021-10-21 14:46:53

Wordpress returns an array when requesting an image. How to use it?

It does not just give a link, but size parameters and several links to the image. How to work with it? In img srcset framed and does not give any result.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivan K, 2021-10-21
@DHARMA373

If you output images via ACF6171795bcdbde923516005.png

A
Artem Zolin, 2021-10-21
@artzolin

$image = get_field('image');
if( !empty( $image ) ) {
  echo '<img src="' . esc_url( $image['url'] ) . '" alt="' . esc_attr( $image['alt'] ) . '">';
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question