Background
Wei was born as an illegitimate child from an adulterous relationship. His father Zheng Ji was a low level official for Pingyang County and was commissioned to serve at the estate of Cao Shou, the Marquess of Pingyang, and his wife Princess Pingyang. There, he had a relationship with a female servant named Wei, and their relationship produced a son, Wei Qing, who took his mother's family name because of the illegitimacy.
As an illegitimate child, the young Wei Qing was detested by his stepmother, father and half-siblings, and was made to live the life of lowly servants. Wei Qing eventually ran away back to his mother's side during his early teenage years, and served as a horsekeeper in the marquess's estate of Pingyang.
After Princess Pingyang offered the singer-dancer Wei Zifu to Emperor Wu as a concubine circa 139 BC, Wei Qing followed as an accompanying gift to serve as a palace horsekeeper.
However, as his sister gained the emperor's love, near disaster would befall Wei. The powerful Grand Princess Liu Piao, the mother of Empress Chen Jiao, angry that Consort Wei had siphoned off the imperial favor that her daughter had previously enjoyed, kidnapped Wei Qing, and wanted to kill him privately as retaliation. However, Wei was rescued at the last moment by his friends.
In response to the incident, and as a show of his own annoyance towards Empress Chen and Grand Princess Liu, Emperor Wu made Wei Qing the head official of the household at Jianzhang Palace away from where the princess might be able to harm him, and awarded Wei Qing with great wealth.