The Hays Code was a censorship code in the United States which was eventualy replaced by actual age ratings. The code was not an age rating system, basically, all films had to be basically no more than PG-rated.
The earliest information I could find was about the British Board of Film Censors, later "Censors" would be replaced by "Classification." According to Wikipedia, "The UK's film ratings are decided by the British Board of Film Classification and have been since 1912. Previously, there were no agreed rating standards, and local councils imposed their own – often differing – conditions or restrictions."
Beyond what these conditions or restrictions were or how they differed, were there age ratings for things like stage plays? Was the United Kingdom or Ireland, which later created the "Irish Film Censor's Office," the first countries to conceive of age ratings? (Although I was told the idea of age restrictions dates back to Plato's Republic.)
Why base them on the age of a person instead of merely notifying that the film may contain some loathsome content?
Even with age ratings in place, there would be censorship that would be quite strict by modern standards, for example, I don't think you would have been allowed to say the F-bomb.
By the way, I intend this question to focus on either fictional entertainment or documentaries. Things like novels, movies, stage plays, and so on.