EDIT: The problem described happened to be related with the use of WhatsApp Web instead of WhatsApp app on the phone.
In my WhatsApp chats a couple of months old, I see placeholders for photos, videos, or voice messages. However, the photo itself is not shown, and when I click on it, the error message appears "Photo unavailable. Can't view this photo because it's no longer on your phone."
I myself have never deleted any of these photos from my phone. The message has not been deleted by the other party. I guess it's WhatsApp itself that deletes the media files after a couple of months. How do I stop this? I want all my sent or received WhatsApp media to be kept on my phone for unlimited time.