the_thumbnail() is definitely a very useful function, but sometimes you just need the featured image URL without all the structure. Here is how you get the featured image URL in any size

And this is how you return it

Tip 1: When getting the URL change the “full” parameter to any other image size (core or custom) to get the URL for that specific size.