Cao Fang ruled from January 239 to October 254 as a nominal emperor before he was deposed by the regent Sima Shi, after which he became known as the "Prince of Qi".
After the fall of Wei in February 266, Cao Fang was conferred the title of "Duke of Shaoling" by Emperor Wu of the Jin dynasty.
Many of Cao's associates, such as Deng Yang (鄧颺), Li Sheng (李勝), He Yan (何晏), and Ding Mi (丁謐), were appointed as high-ranking officials.
In 244, Cao Shuang led an attack on Shu Han's border city of Hanzhong, without careful planning, hoping that he would gain a reputation in the military.
Cao Shuang eventually decided to surrender his authority, against the advice of Huan Fan.
However, a few days later, Sima had Cao Shuang and his family and associates executed on charges of treason.
In 249, Wang Ling, the general in charge of the southeastern city of Shouchun, plotted a rebellion against Sima Yi, in association with Cao Biao (曹彪), the Prince of Chu.
In 251, when Wang was ready to carry out his plan, his subordinates Huang Hua (黃華) and Yang Hong (楊弘) betrayed him to Sima.
Although Sima was defeated, he maintained himself well by publicly admitting his faults and promoting the generals who had advised him against the campaign.
In 254, Sima made a violent move to consolidate power at the expense of Cao Fang.
Cao Fang had endeared himself to the minister Li Feng, and Sima suspected that they were plotting against him.
Cao Fang was angry with Sima Shi about the deaths of Li Feng and Zhang Ji.