Support » Fixing WordPress » get_the_post_thumbnail(get_the_ID(),'medium') WP4.4 issue with srcset

  • I have the same issue. The image is breaking in general about WP4.4 my srcset attribute is combining url and directory in the latest attributes.

    <img width="200" height="200" src="" class="attachment-medium size-medium wp-post-image" alt="image description" srcset=" 80w, 200w" sizes="(max-width: 200px) 100vw, 200px">

    This results in a broken image.

Viewing 1 replies (of 1 total)
  • If anyone else has this issue it is an alternative to use this:

    $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post_id ), 'medium' );

    You can then use the array to output an image tag.

Viewing 1 replies (of 1 total)
  • The topic ‘get_the_post_thumbnail(get_the_ID(),'medium') WP4.4 issue with srcset’ is closed to new replies.