A woman who fraudulently claimed benefits as a single mother for nearly three years was caught when she posted her wedding photographs on Facebook.
Chanice Bowen, 25, of Barry, had told the Department for Work and Pensions she and her partner split up in January 2013, and her benefit payments rose.
But she married him in October 2013, and went on to receive £22,000 she was not entitled to.
She was given a 10-month suspended sentence and told to repay the money.
Cardiff Crown Court heard the DWP had been told about Bowen's Facebook page, with a slideshow of wedding photographs captioned: "Best years of my life, loves my husband."
Prosecutor Andrew Davies said: "In January 2013 Bowen wrote a letter saying Lee Mapstone had left the family home. As a result she received an increase in benefits as a single parent and someone not in work.
"But they married at the civil register office on October 10, 2013."
When interviewed under caution in December 2015, she said she could not remember what she was doing on the day she married her partner Lee Mapstone.
Bowen pleaded guilty to three counts of dishonestly failing to disclose information about being overpaid £21,696 between January 2013 and November 2015.
Adam Sharp, defending, said: "She accepts she embarked on this enterprise out of greed, albeit to support her daughter.
"She is in a stable relationship and actively seeking employment and is fit for work.
"The effects of sending her into custody would have a particularly devastating impact on her family."
Bowen was initially remanded into custody for a night while Judge Stephen Hopkins QC considered her sentence.
However the following day he told her she had "escaped immediate custody by a cat's whisker".
He suspended her sentence after deciding jailing her would have an "enormous" effect on her daughter. Bowen was also ordered to repay the money and to complete 120 hours of unpaid work in a year, plus pay £500 prosecution costs.
The court heard Bowen had already repaid £2,000 over the past year.
A DWP spokesman said: "People pretending to live alone to get benefits is one of the most common types of benefit fraud, and this case shows our investigators are bringing criminals to justice.
"Failure to report a change in circumstances that may affect your benefit claim, such as a partner moving in, is a crime."