I'm trying to insert a post image thumbnail from my php scritp. It's inserting the post, the content, a download link, and I only need to set the thumbnail image to finish my script. This is my code but I can't figure out why is not working, anyhelp would be appreciated:
$url = "http://www.test.com/wp-content/uploads/2015/12/".$title[$key1].".png";
$attr = array(
'src' => basename($url),
'class' => "alignleft",
'alt' => '',
'title' => trim( strip_tags( 'Logo' ) )
);
the_post_thumbnail('thumbnail', $attr );