New answers tagged

1

I found where the problem was. The code was attached to the the_content hook which runs after the thumbnail is generated. Attached the code to post_thumbnail_html and it works now.


4

Don't know why you want to do it when there're update_post_thumbnail_cache() in WordPress and set expire headers on server side. But you can try this in your functions.php: add_filter('wp_get_attachment_image_src', function($img, $id, $size, $icon) { $img[0] = $img[0] . '?v=20160505'; return $img; }, 10, 4);


0

One thing to consider is that the images might be smaller the crop dimensions. If this is true, WordPress will not crop the image, but will instead leave it, resulting in the images being as they are. Try placing this function in your functions.php file or a custom plugin: function wpdev_thumbnail_crop_fix($default, $orig_w, $orig_h, $new_w, $new_h, $crop) ...



Top 50 recent answers are included