NYPD precinct commanders are going back to school to study a subject that’s second nature to any teen — using social media.

After a series of online gaffes — including a joke tweet about a dead woman and a hashtag that became a laughingstock — the NYPD is forcing top officers to take a course in Twitter.

“USE COMMON SENSE” reads a memo handed out to the commanders at the first training session at John Jay College.

The cops are being warned not to post off-the-cuff remarks on Twitter and encouraged to laud community groups, send out wanted posters and post crime stats, information obtained by The Post reveals.

“They want us to put info like street closures or bus diversions because of a street fair. Also info like an accident-prone location or a picture of the cop of the month,” one source said. “Public information stuff.”

Commanding officers are also being told not to release information on crime scenes or investigations.

“I think the training is a good idea. A lot of COs are a bit older, so they might not know how. They may not realize the power or the damage one wrong message can do,” another police source said.

The course is designed to prevent embarrassments like a tweet sent by Capt. Thomas Harnisch of Harlem last month in which he made light of the death of a woman who fell onto the subway tracks at Union Square while using an iPad.

“Let me guess, driver’s fault right?” he wrote over his personal account in a tweet directed at a safe-streets advocacy group.

Blasted by a group member, he wrote on the official precinct account: “Isn’t that exactly what you do? Seize on a tragedy and assign culpability having no facts?”

He later apologized.

The NYPD suffered its biggest Twitter fail in April, when it began a p.r. campaign urging the public to post photos of the city cops with the hashtag “#myNYPD.”

Users instead posted images of police brutality.

Zachary Tumin, the NYPD’s deputy commissioner for strategic initiatives, said social media can be a tool for cops.

“It’s an opportunity for commanding officers . . . to share news while engaging with the people whom she or he serves,” he said.