Often, when working with WordPress, you’ll find the need to grab a post’s thumbnail source URL. Unfortunately, the_post_thumbnail() and get_the_post_thumbnail() only return the entire image tag.
This handy little WordPress code snippet takes care of it for you, though:
As you can see, you can post in a $post object or let it use the globalized $post object… depending on your needs. You can also pass in the image size you’re after. By default, it uses the “thumbnail” size.
Hopefully, you find it useful.