WordPress Hack #3

Here’s a function that really should be in WordPress core by now. And maybe it is and I just can’t find it. But to get the source url for a post thumbnail you have to hack. Here it is:

/** 
**
** Parameters: 
** Size (optional): The width/height of the source image. Accepts either a string designating the WordPress image size, ( i.e. "thumbnail", "full","medium") or an array containing a custom size, i.e.  array(250,250) . Defaults to full size
**/
function get_post_thumbnail_url($size = 'full') {
global $post;
$src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), $size, false, '' );
echo $src[0];
}