I stumbled on a rumor on the interwebs and wanted to find it's validity.
In addition to the comments in the above thread, see Strauss and Perkins' Worst. President. Ever.: James Buchanan, the POTUS Rating Game, and the Legacy of the Least of the Lesser Presidents, a recent biography of Buchanan.
As you likely know, Buchanan never married: he was the only President to remain a lifelong bachelor. The most parsimonious explanation for Buchanan's bachelorhood is that he was filled with regret and shame following his failed engagement to Anne Caroline Coleman, the daughter of a wealthy iron manufacturer. The two met in 1818 and fell deeply in love, but in 1819, due to the strain of Buchanan's travel for work and rumors that he was committing adultery or marrying her only for her money, she broke off the engagement. She died a few weeks later, possibly having committed suicide. Her father forbade Buchanan from attending the funeral. Buchanan wrote that "I feel happiness has fled from me forever" and reportedly never showed much interest in women thereafter: possibly this traumatic experience ruined his desire for a romantic relationship, and it may even have made him somewhat risk-averse in politics, a tendency that manifests in many of the decisions he made in his political career (it arguably helped him earn the Democratic nomination in 1856, him being one of the few candidates who hadn't pissed many people off).
Much has been made of Buchanan's relationship, including cohabitation, with William Rufus King, but such cohabitation between bachelors was not unheard of at the time. Even sharing a bed wasn't uncommon: it was often a matter of convenience, not romance. (The "romantic friendship" hypothesis suggested in the above thread may also be correct: as /u/zeroable argues, though, it is not obvious whether this should be treated as "homosexuality".) Strauss argues that the desire to mark Buchanan as gay is a misguided attempt to claim an American hero for the LGBT cause--misguided, no less, because other than probably not being gay, Buchanan is hardly the model of a President to aspire to.
More can definitely be added on here, but this older thread has a few comments which might be of interest for yo9u, especially that from /u/zeroable .