That September, it was published in The Youth's Companion, and gained steam from there. By 1905, 19 states had passed school flag laws involving the Pledge. By 1923, the words "my Flag" had been changed to "the flag of the United States", apparently to avoid confusion. One year later, the National Flag Conference added the words "Of America.”
In 1940, the landmark Minersville v Gobitis case was filed, after two children were expelled for refusing to recite the pledge. Their rationale for doing so was their faith, as they were from a family of Jehovah's Witnesses, who refuse to swear to any power besides God. The Pledge was adopted nationally as part of the Flag Code in 1942, the same year that the Supreme Court decided the Gobitis case was decided.
In Gobitis, the court ruled that the Gobitis children did not have the right to abstain from saying the Pledge. Justice Frankfurter wrote the opinion of the court.