“We knew that our principal was basically trying to cut us off,” Ms. Stack said.

Ms. Stack and Ms. Madhira added that teachers had blocked students who tried to join the walkout, and that the singing of the school song had been disrupted by students who joked about school shootings and offered Nazi salutes.

“It was a mess,” Ms. Stack said. “And so Neha wrote that.”

Ms. Madhira submitted the opinion piece to Mr. Burdett, who barred it from publication, saying it was not representative of the views of the school’s 3,000 students. Prosper High officials and Ms. Oglesbee-Petter declined to comment for this article.

“We live in a democracy where the First Amendment isn’t instinctive,” said Mike Hiestand, the senior legal counsel at the Student Press Law Center, a group that provides free legal help to high school and college journalists. “It’s learned and nurtured, and we certainly are not providing a whole lot of opportunity for students to learn the First Amendment in a firsthand kind of way.”

In Herriman, Utah, an enterprising school publication ran into trouble after digging into a subject that administrators at Herriman High School had tried to keep secret: the reason for the dismissal of a popular history teacher.

Conor Spahr, 18, spent more than a month looking into why the teacher had stopped showing up for his classes last fall. After reviewing public records and interviewing students and teachers, Mr. Spahr reported in The Herriman Telegraph that the teacher “was sending highly inappropriate messages to a female student,” according to an unnamed person described in the article as a “source.” The morning after the article went live, it was gone.