Support

Account

Home Forums General Issues Image field as content returns only the url Reply To: Image field as content returns only the url

  • If you want to display an image tag you’re best choice is to set the field to return the attachment id, then use that to call one of the WP functions to get the image. The easiest way would probably be http://codex.wordpress.org/Function_Reference/wp_get_attachment_image

    
    $attachment_id = get_field('my_image_field');
    if ($attachment_id) {
      $size = 'full'; // set to the defined image size you want
      $image_tag = wp_get_attachment_image($attachment_id, $size);
      if ($image_tag) {
        echo $image_tag;
      }
    }