The judge correctly identified the law in question as regulating speeched based on content (content based regulation).

As such, the proper legal standard is strict scrutiny:

1. The government must demonstrate a compelling government ineterest in regulating the speech and
2. assuming the government has demonstrated such a compelling interest, it must show that the regulation is narrowly tailored to meet such an interest.

The government (rather poorly in my opinion) failed to demonstrate a compelling interest, and as such the judge never had to go on to consider the above second element.

It remains to be seen whether other, smarter, more motivated government lawyers can properly identify to higher courts a compelling interest in regulating the type of speech here.