“Gotham” star Ben McKenzie, who plays Jim Gordon on the Fox show, is grateful that social media wasn’t popular yet when he was still starring as troubled teenager Ryan Atwood in the teenage soap “The O.C.”

Had Facebook, Twitter and Instagram been popular then, McKenzie suspects that he would have made a lot of social media faux pas.

“I definitely wouldn’t have been able to navigate that as well as a 23-year-old,” he told The Huffington Post. “God, if any of the mistakes I’ve made over the years were widely viral sensations, I’m sure I’d pay a price for it in my career or whatever.”

While it’s true that social media helps celebrities connect with their fans better, McKenzie prefers to keep a “very distinct line” between his career and his personal life.

Looking back on his days in “The O.C.,” which starred Seth Cohen, Mischa Barton, Rachel Bilson and Peter Gallagher, McKenzie feels nostalgic. He says it feels just “like yesterday” when they were filming the show, and he hopes today’s generation will try and watch the show.

“There’s a whole generation of ― I call them ‘kids’ because I’m so old ― but, like, younger people who would have enjoyed ‘The O.C.’ except they were not born yet,” he said.

As for “Gotham,” McKenzie won’t have any trouble attracting young viewers, especially since Season 3 of the show will be introducing a lot of interesting new villains.

“We're bringing in a whole new crop of villains, including Mad Hatter, who is a personal favourite of mine from the comics. I'm fascinated to see what the actor we have hired — Benedict Samuel — does with that,” McKenzie said, according to the Business Standard.

Gordon will even have a new love interest in Valerie Vale (Jamie Chung), and she would definitely add an interesting twist to his love story with Dr. Lee Thompkins (Morena Baccarin).

“Jim likes that she’s so aggressive, that she’s so unapologetic,” the actor told TV Line of Valerie. “She almost literally slaps him back into taking stock of his life, and that’s something that a guy in his position can appreciate.”

“Gotham” airs Mondays at 8 p.m. ET on Fox. Gotham Ben McKenzie plays Jim Gordon in the Fox show “Gotham.” Photo: Fox