WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For some reason the following isn't loaded anymore in wordpress 3.5. Does anyone know how to fix the get_the_post_thumbnail() ?

I'm using the follow code:

echo "<div class='meta_apps'>";
echo "<a href='"; the_permalink(); echo "'>";
echo "<div class=\"meta-icon\">".get_the_post_thumbnail($post->post_id, 'thumbnail', $attr)."</div>";
echo "<div class=\"meta-title\">".$post->post_title."</div>";
echo "</a>";
echo "</div>";
share|improve this question
up vote 2 down vote accepted

I could be mistaken, but I don't think $post->post_id works to retrieve the post's ID. I believe you want $post->ID. So that was probably your issue to begin with, though without seeing your $attr array, it's hard to say. Here's a reference for $post's properties. In this case, get_the_post_thumbnail is the more appropriate function.

In your answer you posted for yourself, you're using the_post_thumbnail incorrectly. First off, you don't need to echo it; the_post_thumbnail will output the thumbnail. Side note: Any function in WordPress that starts with the_ is almost always going to output something automatically. Second, You don't need to pass it $post->ID (again, using the wrong property). Third, the first property of the_post_thumbnail is the size, e.g. "thumbnail".

share|improve this answer
Thanks matthew, i'm not a programmer so these kind of basic stuff makes my head spin sometime. Thanks for your answer, it helps alot! – rwzdoorn Dec 13 '12 at 10:13

Problem solved,

                echo the_post_thumbnail($post->post_id, array('class' => 'meta_icon')); echo "</div>";

Don't use 'get_the_thumbnail' but simply use the_post_thumbnail.

share|improve this answer
An echo is not required here, the the_post_thumbnail function already echos the image. codex.wordpress.org/Function_Reference/the_post_thumbnail – Jason Dec 14 '12 at 11:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.