I have used this method successfully on both fabrics and clothes that were bleeding.
https://www.dharmatrading.com/chemicals/retayne.html
The summary is that I soaked the items in Retayne and hot water for 30 minutes, then handwashed with Synthapol, rinsed, and dried in the dryer. Then I (machine) washed them again with a white rag to make sure there was no more bleeding.
I didn't know the items would bleed until I washed them, so I don't think it's critical to use it before washing them for the first time. It's always going to be after I've washed something, because I'm not going to treat everything with Retayne just in case.
I haven't had the bleeding come back, and as far as I know the fixing is permanent.