A celebrity critic of vaccines and former partner of another star with an autistic child has taken to social media to denounce a new California law requiring most children be vaccinated.

Jim Carrey dated Jenny McCarthy for about five years before they split in 2010. In 2005, McCarthy’s son Evan was diagnosed with autism; during their relationship and after their breakup, Carrey and McCarthy were vocal proponents of the discredited theory that vaccines and autism are linked.

Carrey, it seems, is still a believer. He slammed California Gov. Jerry Brown (D) on Twitter for Brown’s decision to sign Senate Bill 277, which forces schoolchildren to be vaccinated regardless of their families’ religious or personal beliefs.

Advertisement

‘‘California Gov says yes to poisoning more children with mercury and aluminum in manditory (sic) vaccines,’’ Carrey wrote. ‘‘This corporate fascist must be stopped.’’

Get The Weekender in your inbox:

The Globe's top picks for what to see and do each weekend, in Boston and beyond.

‘‘They say mercury in fish is dangerous but forcing all of our children to be injected with mercury in thimerosol is no risk. Make sense? I am not anti-vaccine. I am anti-thimerosal, anti-mercury. They have taken some of the mercury laden thimerosal out of vaccines. NOT ALL! The CDC can’t solve a problem they helped start. It’s too risky to admit they have been wrong about mercury/thimerasol. They are corrupt. Go to traceamounts.com watch the documentary and judge for yourselves. If you really care about the kids you will. It’s shocking!’’

Carrey linked to the website for ‘‘Trace Amounts: Autism, Mercury, and the Hidden Truth,’’ a 2014 documentary that examines ‘‘the role of mercury poisoning in the Autism epidemic.’’ (Low doses of the preservative thimerasol, which contains mercury, are not harmful, according to the Centers for Disease Control and Prevention; however, it is not used in most childhood vaccines ‘‘as a precautionary measure.”)

‘‘It was a rare moment in the spotlight for a group that has been increasingly shunned and chastised,’’ the Los Angeles Times wrote of the film’s premiere in February. ‘‘Though anti-vaccine proponents say they are doing what they believe is best for their children, pro-vaccine parents argue that choosing not to vaccinate puts the overall health of a community at risk.’’

Advertisement

Those who insist vaccines are dangerous or may cause autism drew ire in California earlier this year after a measles outbreak at Disneyland in Anaheim. As the measles spread to 17 states and the District of Columbia, arguments of anti-vaxxers seemed to shrivel in the face of, among others, a 7-year-old boy undergoing chemotherapy who, too ill to be vaccinated himself, explained the importance of herd immunity at a school board meeting.

‘‘My name is Rhett, and I give a damn,’’ Rhett Krawitt said to a cheering crowd in Tiburon, California. ‘‘Soon we will say, ‘Gone with the measles.’’’

‘‘The science is clear that vaccines dramatically protect children against a number of infectious and dangerous diseases,’’ Brown wrote in his signing message, as the San Jose Mercury-News reported. ‘‘While it’s true that no medical intervention is without risk, the evidence shows that immunization powerfully benefits and protects the community.’’

As vaccine critics, Carrey and McCarthy seemed unswayed by such arguments.

‘‘We’re here to lend our voices for the millions of people calling for balance and moderation when it calls to substances that we give our children,’’ Carrey said at a march in Washington in 2008. ‘‘They are not bottomless pits that you endlessly pour the substances into. You have to consider the cumulative effect. Not only that, the possible interaction. Every other drug has interaction with other drugs and yet they assume vaccines won’t.’’

Advertisement

Even after the work of Andrew Wakefield, the doctor who created the myth that vaccines cause autism, was discredited, Carrey and McCarthy stood by their man — and were pilloried for it.

‘‘What they’re really doing is irresponsibly using their disproportionately powerful media platform to spread misinformation about a condition for which there is no known cure, and rehabilitating the reputation of a doctor on whom history ought to turn the page,’’ Jim Edwards of Moneywatch wrote in 2010.