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

I am using wordpress 3.4.1. I need to display the featured image of a page. How can i get the featured image url by particular page id. Any help?

share|improve this question
up vote 9 down vote accepted

Did you try anything? Its always helpful to share what you have tried.

$url = wp_get_attachment_url( get_post_thumbnail_id($post_id) );

Or if you want to get the image by image size.

$src = wp_get_attachment_image_src( get_post_thumbnail_id($post_id), 'thumbnail_size' );
$url = $src[0];




share|improve this answer
It works. Thanks – Sam Hanson Dec 22 '12 at 7:59
Actually, this is wrong - it suggests that you can get pass the size as a parameter, but that's not accurate. Neither function accepts a parameter. – cale_b Jun 20 '14 at 3:35
@cale_b: Thanks for pointing out. Fixed. – Sisir Jun 20 '14 at 10:15

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.