In the script below, I need to get the URL path to the "medium" size image in the "data-responsive" attribute. Its currently returning the thumbnail size.

        'itemprop' => 'image',
        'class' => 'alignleft', 
        'style' => 'margin:5px 15px 10px 0;', 
        'data-responsive' => wp_get_attachment_thumb_url(get_post_thumbnail_id($post->ID),'medium')

I want the thumbnail used as the default image, however, I need to write the URL to the medium sized image so that I can use that in media queries to swap the image to higher res on larger devices.

1 Answer 1


wp_get_attachment_thumb_url() does not accept size as argument.

You might be looking for wp_get_attachment_image_src(), but I am not sure on top of my head - too many functions in that corner.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.