From the Atlantic in 2014
When Hamas’s leaders surveyed their assets before this summer’s round of fighting, they knew that among those assets was the international press. The AP staff in Gaza City would witness a rocket launch right beside their office, endangering reporters and other civilians nearby—and the AP wouldn’t report it, not even in AP articles about Israeli claims that Hamas was launching rockets from residential areas. (This happened.) Hamas fighters would burst into the AP’s Gaza bureau and threaten the staff—and the AP wouldn’t report it. (This also happened.) Cameramen waiting outside Shifa Hospital in Gaza City would film the arrival of civilian casualties and then, at a signal from an official, turn off their cameras when wounded and dead fighters came in, helping Hamas maintain the illusion that only civilians were dying. (This too happened; the information comes from multiple sources with firsthand knowledge of these incidents.)
This is true not just in the case of Hamas but even of Western countries. They are sometimes called ground rules. During WW2 war correspondents had to file through a censor. Recall that CNN was accused of the same access capture thing in relation to Saddam.
It’s an occupational hazard. The problem is not declaring it.