My website have about 1000 post with image setting thumbnail, medium, large...

<img class="size-medium" src="../test-600x337.jpg" alt="" width="600" height="337">
<img class="size-thumbnail" src="../test-100x100.jpg" alt="" width="100" height="100">
<img class="size-large" src="../test-1000x1000.jpg" alt="" width="1000" height="1000">

With function.php, how do I get it to return the URL for the original image (full sized image) because i deleted all image resize in my host.

Many thanks for your time and help.

1 Answer 1


According to your description, in your template, it currently fetch image with specific size such as 'thumbnail' or 'medium' and so on. You want to change that with a main control and force them to use original image, right?

If so, you may try the filter post_thumbnail_size

add_filter( 'post_thumbnail_size', 'q363844_modify_image_thumbnail_size', 10, 2 );
function q363844_modify_image_thumbnail_size( $size, $post_id ) {
    // because you want to return original, you can set it to 'large'
    return 'large';

But in the long run, I think it is not good for your website traffic and optimisation. You may consider to use a plugin by searching keywords regenerate thumbnail in plugin repository.

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.