Lord Justice Pitchford and Mr Justice Simon ruled the anonymity order must be discharged.
The judge said that the course used by David McGreavy's legal advisers when applying for anonymity was "wrong".
The ruling was a victory for the Justice Secretary and national newspaper publishers who all worked together last month, after the Press Association alerted them, to say that the order was legally flawed and was wrong to stop the public from knowing all the facts in the case.
Counsel Guy Vassall-Adams had told the judges that even "the nature of the victims" could not be revealed.
More top news
A man who launched a series of machete attacks after suspecting his estranged wife of having an affair has been jailed for 28 years.
The judge has analysed the dispute at a two-day High Court hearing in London and is due to deliver a ruling at 11am on Wednesday.
Services at the Royal Shrewsbury Hospital’s Midwife Led Unit are expected to stay closed until 12pm on Wednesday 20 September.