im 20 for reference. ever since i was a kid, up until hs, we were forced every morning to stand, look at the flag and hold our hearts and say:
“I pledge allegiance to the Flag of the United States of America, and to the Republic for which it stands, one Nation under God, indivisible, with liberty and justice for all”
i didnt stand a single time because i disagreed with being forced, and i was berated by the teacher in front of everyone, and he threatened to kick me out of class if i ever did it again. i was about 11-12 then, it was 2015.
It looks like there were a bunch of challenges in the 90s that got struck down. https://www.findlaw.com/education/student-rights/the-pledge-of-allegiance-and-legal-challenges-in-education.html An actual lawyer would know more detail, I bet.
Based on the timing, the 1998 ACLU lawsuit was probably what I was remembering. Would have put me right around my peak pain-in-the-ass years.