I am currently using the following code to get the URL of the featured image of a wordpress post:

URL="<?php if (function_exists('wp_get_attachment_thumb_url')) {echo wp_get_attachment_thumb_url(get_post_thumbnail_id($post->ID), 'big-size'); }?>"

But the code only returns the smaller (150x150px) thumbnail. This is what I get:


My question is, how do I get it to return the URL for the original image (full sized image) which would be:


Many thanks for your time and help.

3 Answers 3


There are four valid sizes built in to the WordPress core.

the_post_thumbnail('thumbnail');    // Thumbnail (default 150px x 150px max)
the_post_thumbnail('medium');       // Medium resolution (default 300px x 300px max)
the_post_thumbnail('medium_large'); // Medium Large resolution (default 768px x 0(means automatic height by ratio) max) since WP version 4.4
the_post_thumbnail('large');        // Large resolution (default 640px x 640px max)
the_post_thumbnail('full');         // Original image resolution (unmodified)

The last is one you're looking for.

The following returns the URL.

  $src = wp_get_attachment_image_src( $attachment_id, $size, $icon );
  echo $src[0];

The whole code can look like that:

  $src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full', false );
  echo $src[0]; // the url of featured image

More information can be found here.

  • Thanks for your answer. I am actually looking for a function to return the "URL" of the image and not the image itself. So I doubt if the_post_thumbnail is going to work for that. Or perhaps I am wrong? Nov 3, 2014 at 17:32
  • @theshorttree see my updated answer.
    – SLH
    Nov 3, 2014 at 17:34
  • That totally worked, thanks a lot for your time and reply! Nov 3, 2014 at 17:56
  • Still relevant in 2022. I wanted a thumbnail but the_post_thumbnail_url() was returning full images because the default parameter value is 'post-thumbnail' instead of 'thumbnail' but my new custom theme did not have that. Thanks to this list, I found the solution to show thumbnails: <img class="post-thumb" src="<?php the_post_thumbnail_url('thumbnail') ?>"> Jul 26, 2022 at 2:15

For those who are coming here post October 2019

WordPress has introduced a "Big Image Threshold" since version 5.3 (Link)

In short all images above 2560px will be downscaled on upload. Calling the image format "full" will no longer always return the original untouched image but might return that 2560px version and will have '-scaled' in the url and path.

You can still get the url and path of the originally uploaded images with the following functions: wp_get_original_image_path() or wp_get_original_image_url(). Although the documentation suggests a new size "original_image" was added, wp_get_attachment_image, wp_get_attachment_image_src or similar functions still return the scaled down version. So as far as I can tell no way to get the original file dimentions etc.

  • This should be current accepted answer! Mar 25, 2021 at 15:12

A bit late to the party,


get_the_post_thumbnail_url(null,'full'); does exactly the job, where full can be replaced by thumbnail, medium, medium_large or large.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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