Springfield Elementary School teacher Mrs. Edna Krabappel feels increasingly lonely, and, searching for love, places a personal ad in the newspaper. A yo-yo craze sweeps through the school after a group of four demonstrate the potential of the toys. Bart breaks the class fish tank with his yo-yo, and is given one month of detention by Mrs. Krabappel. While snooping in her desk to take back his yo-yo, he discovers her personal ad and decides to get revenge on her, by pulling a prank and responding by mail. He creates a new adult male alter ego named Woodrow, after former President Woodrow Wilson. Mrs. Krabappel responds by sending a suggestive photograph. Bart writes a response to Edna using lines from an old love letter Homer had sent Marge.
Meanwhile, Marge notices that their dog Santa's Little Helper needs a new dog house. She wants to buy one, but Homer says that he can save money by building one instead. His infuriating attempts at constructing the dog house cause him to curse loud enough for Todd Flanders to overhear. Todd says "hell no" and "damn" at the dinner table, so his father Ned tries to find out where he learned such language - with possibilities being bumper stickers, comic books, Grandma, television and his elder brother Rod. Ned discovers that Homer is the source when he and his kids hear him curse in frustration after getting his jacket stuck to a piece of wood in another failed attempt to build a dog house. He complains to Homer, who in turn criticizes Ned's mustache. Ned promises to shave off his mustache in return for Homer's curtailing uses of profanity. When Homer claims that it is too late for him to stop, Marge disagrees and reveals her own experience with her father's cursing that lead her mother to use a swear jar. Homer promises to put money in a "swear jar" - 25 cents for each curse. The next couple of days he keeps his word to put money inside the jar for every time he uses profanity in frustration (this including accidentally placing a 20 dollar note in the church collection plate, failing to knock down all the pins while bowling, seeing a newly clean shaven Ned who got hired as a spokesman in a commercial, failing yet again to build a dog house and having a beehive fall on him while sleeping in a hammock) until it gets to the point where he instead speaks calmly upon being injured; "I'm not going to swear, but I am going to KICK THIS DOGHOUSE DOWN!". Homer's constant cursing puts more than enough money in the swear jar to purchase a dog house for Santa's Little Helper, along with an added bonus; Duff Beer for Homer for at least committing.
Edna asks "Woodrow" for a photograph, so Bart searches through a book called NHL Stars of 1969 and sends her a picture of hockey star Gordie Howe. Bart, as Woodrow, writes Mrs. Krabappel more letters, telling her what she wants to hear. He then sends a letter asking for them to meet at the Gilded Truffle. Bart sees Mrs. Krabappel waiting for Woodrow, and laughs as he goes to watch a movie. On his way back home he sees Mrs. Krabappel still waiting at the empty restaurant, all alone and on the verge of tears. Bart feels guilty to see her so sad.
Bart talks to Mrs. Krabappel after class and starts to feel worse about what he did when he is unable to console her. He confesses to the family what he has done, and, realizing the truth would humiliate her, they all write a poetic and loving letter to tell her why Woodrow must leave which makes Mrs. Krabappel feel better. On Bart's last day of detention, Mrs. Krabbapel suggest they spend it outside and Bart agrees.