A child born inside a marriage is legally considered a child of that marriage regardless of actual paternity. The ability for men to claim children as chattel (because they used to be considered assets more than liabilities) is why marriage exists in the first place. It’s also why it’s a public, legal contract and not just a private or religious rite. Revealing the child’s bio-paternity while denying visitation doesn’t give the couple grounds to shake down the bio-father for child support. Ted would have to relinquish his parental status first. It would be precedent-setting if a court decided differently.
If she married Ted after the birth, it’s a different story entirely.