The First Amendment is a constant, like a straight line, applicable to every American and all speech. The First Amendment gives you the right to say anything. However, the courts have recognized that there are a few rules that supersede even the First Amendment -- the classic "can't say fire in a crowded theater," but also libel, blatantly false advertising, etc. It's not that the First Amendment doesn't apply, but some other law or rule has higher priority, i.e. above that flat, constant line that is the 1st.
A government official privy to classified information is subject to secrecy rules that supersede the 1st. The question at issue is whether a journalist who becomes privy to the the same classified information is subject to the same rules. "The question before the court was whether the constitutional freedom of the press, guaranteed by the First Amendment, was subordinate to a claimed need of the executive branch of government to maintain the secrecy of information." i.e. which takes priority, the 1st, or rules about secrecy (the Espionage Act, in this case).
From your wikipedia article: "New York Times v. United States ... did not void the Espionage Act or give the press unlimited freedom to publish classified documents." The Court did not say that journalists have free reign, they simply refused to grant an injunction against publication. While this, and subsequent cases, certainly signal wide breadth of press freedom, it's not absolute and not a guarantee against a future prosecution.
https://www.npr.org/sections/thetwo-way/2017/03/22/521009791...
FBI Director James Comey demurred. "That's a harder question, as to whether a reporter incurs criminal liability by publishing classified information," Comey said.
freedom of the press is not absolute, even in the U.S. According to a recent paper from the Congressional Research Service, the question is far from settled
The justices didn't block the government from exercising what's called "prior restraint" — that is, preventing a news organization from publishing or broadcasting news.