This is a personal decision because everyone is different. Some people remain friends with their exes so it’s perfectly fine to invite him or her if the wedding couple both agree. If the ex is invited for malicious reasons, like making her jealous, then it’s best to not invite them.