Add version query tag to all images

Don’t know why you want to do it when there’s 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={$some_version}';

    return $img;
    
}, PHP_INT_MAX, 4);