Use thumbnail image using url of that image

Get the image ID from the URL with attachment_url_to_postid():

$image_id   = attachment_url_to_postid( $image_url ); 

Convert the ID to the thumbnail image URL with wp_get_attachment_image_src:

$thumbnail_url = wp_get_attachment_image_src( $image_id, 'thumbnail' );

Leave a Comment