In a move that shocked the media world, John Skipper on Monday resigned as president of ESPN, citing a yearslong battle with substance abuse.

“I have struggled for many years with a substance addiction,” Skipper, who turns 62 on Tuesday, said in a statement. “I have decided that the most important thing I can do right now is to take care of my problem.”

ESPN, a division of Disney, said George Bodenheimer will assume Skipper’s responsibilities for the next 90 days and assist Disney Chief Executive Bob Iger in the search for a permanent successor.

Bodenheimer led ESPN for 13 years, holding the titles of president of ESPN and co-chairman of Disney Media Networks, until 2011, when he handed the reins to Skipper.

Skipper’s ESPN tenure has had many successes, including inking the rights to “Monday Night Football,” signing a long-term TV deal with the NBA and, as head of content since 2005, taking subscriptions to a peak of 100 million.

More recently, though, it’s been tough sledding — as ESPN has lost 13 million subscribers and has been forced to undergo three rounds of layoffs as a result of exploding rights fees and a tough ad environment.

It’s been equally tough off the screen.

Accusations of sexual harassment at ESPN under Skipper’s watch have triggered several lawsuits, according to a Boston Globe report on Dec. 14.

“It is always a work in progress, but we’re proud of the significant progress we’ve made in developing and placing women in key roles at the company in the board room, in leadership positions throughout ESPN and on air,” the network said in a statement to The Post on Monday, countering the Globe story.

Internal pressures were great enough for Skipper to call ESPN’s massive team of on-air talent together last week and assure it the network was headed in the right direction.

The meeting also addressed social-media guidelines after ESPN anchor Jemele Hill made unwanted headlines by comparing President Trump to a white supremacist.

Skipper, whose $5 million-a-year contract was renewed last month, didn’t identify the substance of his addiction. But if it impaired his on-the-job performance, he could be denied his severance.

“Executives with employment contracts generally have a ‘cause’ definition about drugs or alcohol affecting their performance,” said Gavin McElroy, chairman of executive compensation and employment at Frankfurt Kurnit. But stuff done off work hours wouldn’t count, he said.

Given the shock felt by many who worked close to the highly visible executive, it appears Skipper hid his addiction from colleagues.

Hill, whom Skipper suspended earlier this year, tweeted: “John Skipper is one of the finest people I’ve ever worked for.”

Bob Guccione Jr., who hired John Skipper in 1990 to serve as Spin magazine’s president, said Monday he was “stunned” by the ESPN boss’ addiction admission.

“I never ever saw him do drugs at Spin, or outside when we had events — not even pot,” Guccione told The Post in an e-mail. “I see him pretty regularly … and he always has phenomenal energy and laser focus.”

Skipper soon left Spin for Disney Publishing Group, then moved over to help launch ESPN The Magazine in 1998.

News of his exit even brought on-air tears from Dan Le Batard, who on his ESPN radio show said,“I just want to know that he’s OK.”

He also oversaw ESPN.com and ESPN’s other internet properties before his 2005 promotion to head of content.