The Chinese media have never had much freedom to pursue muckraking stories, or even to dutifully report the facts. Now, President Xi Jinping is going to extraordinary lengths to rein the press in even further.

Mr. Xi recently visited the three main newsrooms in the country to convey in unmistakable terms that journalists are expected to behave like apparatchiks. That message, which predictably received fawning coverage, came a few days after the government announced it would further restrict foreign media, too.

Under rules Beijing says it will start enforcing next month, foreign companies will be barred from publishing online content — including text, videos, maps and games — in China without prior approval from the government. The regulations, which could affect major American companies including Amazon, Microsoft and Apple, are intended to “promote core socialist values.”

Those stifling steps will add to the information barriers Chinese people already face. Major sites, including Google, Facebook and Twitter, which hundreds of millions of people around the globe use, are already blocked in China. The Chinese government began blocking access to the English and Chinese websites of The New York Times in 2012, in retaliation for an article that exposed the hidden wealth of relatives of Wen Jiabao, who was then prime minister.