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.
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.
Share Improve this question edited Apr 12, 2020 at 11:22 fuxia♦ 107k39 gold badges255 silver badges459 bronze badges asked Apr 12, 2020 at 11:02 tientruong0810tientruong0810 11 Answer
Reset to default 0According 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.