In a statement issued on Monday, Treasurer Josh Frydenberg said the government had decided that this measure, which was originally supposed to be implemented in November if a voluntary code did not work out, had to be implemented right away.
The Australian Competition and Consumer Commission conducted an inquiry in 2018 and released the results to the government in June last year. The findings were made public in July.
At that time, the government said it would give its response by the end of the year; the shape of that was to ask the ACCC to work along with digital platforms like Facebook and Google to develop a voluntary code so that publishers were not disadvantaged.
"At the same time, while discussions between the parties have been taking place, progress on a voluntary code has been limited according to recent advice provided by the ACCC following a request by the government for an update," the statement said.
"The ACCC considers it is unlikely that any voluntary agreement would be reached with respect to the key issue of payment for content."
The code will cover sharing of data, ranking and display of news content and the monetisation and the sharing of revenue generated from news.
"The mandatory code will also establish appropriate enforcement, penalty and binding dispute resolution mechanisms," the statement said.
"A draft mandatory code will be released for consultation by the ACCC before the end of July, with a final code to be settled soon thereafter."
Earlier this month, it was reported that Google had agreed to comply with a ruling in France that it must pay publishing companies and news agencies for re-using content they produce.