McDonald’s will recall about 12 million “Shrek” drinking glasses because federal regulators found they contain the toxic metal cadmium, which poses health risks.

The glasses have been sold for $2 apiece at McDonald’s restaurants across the country as a promotional tie-in with the movie “Shrek Forever After.” Purchasers will be advised to keep them away from children and to return them to McDonald’s for a refund.

The recall, which will be officially announced Friday by the Consumer Product Safety Commission, was set in motion by an anonymous tip to Rep. Jackie Speier (D-Hillsborough) last week. She alerted the commission, which tested the glasses and confirmed the presence of cadmium in the paint used for the decorative characters. Cadmium is a carcinogen and can cause kidney, lung, intestinal and bone damage.

Speier’s office said McDonald’s voluntarily agreed to recall the glasses at the urging of the commission.

A McDonald’s spokesman, Walt Riker, said in an interview: “We’ve had a good, constructive two-way dialogue with the congresswoman’s office and with the Consumer Product Safety Commission.”

Although Speier commended McDonald’s for acting quickly, her office said the fast-food giant and other corporations must “do a better job of thoroughly reviewing their domestic and international supply chains to keep products with potentially dangerous elements from ever hitting their shelves.”

It was not immediately known where the glasses were produced or how the paint used in the “Shrek” characters came to contain cadmium.

“Our children’s health should not depend on the consciences of anonymous sources,” Speier said. “Although McDonald’s did the right thing by recalling these products, we need stronger testing standards to ensure that all children’s products are proven safe before they hit the shelves. Cadmium is a toxic substance that is extremely dangerous to the developmental health of children.”

The commission declined to comment Thursday evening. In the past, the commission has warned manufacturers to avoid cadmium in children’s products, and last month it ordered the recall of children’s jewelry contaminated by the toxic metal.

Speier said the McDonald’s episode pointed to the need for stronger safety measures. Earlier in the year, she introduced legislation banning cadmium and other toxic metals from children’s jewelry.

peter.nicholas@latimes.com