-
get_the_post_thumbnail ( $post/$post_id, $sizes, $attr )
will give you the featured image as html to output. -
get_post_thumbnail_id ( get_the_ID ( ) )
will give you the ID of the featured image so you can use it to get more information. Getting the thumbnail ID is essentially accessing the the post’s meta data:$image_id = get_post_meta( $post->ID, '_thumbnail_id', true )
-
wp_get_attachment_metadata ( $attachment_id, $unfiltered )
will give you all the meta data associated with the image. -
wp_get_attachment_image_src( $attachment_id, $size, $icon )
will give you an array of information for a particular size.
[0] => url
[1] => width
[2] => height
[3] => boolean: true if $url is a resized image, false if it is the original or if no image is available.
In the above example you can get the src and id using:
$image_src = media_sideload_image($video_thumb_url, $description, 'src');
$image_id = attachment_url_to_postid($image_src);
set_post_thumbnail($post_id, $image_id );