WhatsApp has introduced a new feature that lets users edit captions for various media types, such as images, videos, GIFs, and documents, even after they have been sent. To use this feature, you must update your WhatsApp to the latest version (both iOS and Android devices).
The feature's rollout was delayed initially, but it is now widely available. You can check if you have it by long-pressing a recent captioned message. It has a limitation, though. You can only edit captions within 15 minutes of sending them and only from the device that sent them.