How to get Thumbnail URL in WordPress

Hi everybody, here is a simple snippet which allows you to extract the source of the post thumbnail image on WordPress. It’s very useful if you need post thumbnail URL to use in your code.
Simply copy and paste the following code to your theme template. Please make sure that the code is pasted within the loop.

<?php
//  Get WordPress Thumbnail URL
 
$image_id = get_post_thumbnail_id();
$image_url = wp_get_attachment_image_src($image_id);
$image_url = $image_url[0];
?>

Related posts:

Partner with Us

We are providing an exclusive partnership offer to individuals and companies who are interested in setting up their own web design & development company. For more information about how to partner with us, please contact us