The King signed over his kindgom (and the rightful kingship) when he signed the "Problems Disappear" magical contract. This is addressed directly in Shrek 4.
Harold: So you'll put an end to our daughter's curse?
Rumpelstiltskin: And, in return, you sign the kingdom of Far Far Away over to me.
We know, from Shrek the Third, that Harold can designate someone else as King, based on the fact that Fiona and Shrek (who were the rightful heirs to the throne) choose Artie to be the next King of Far, Far Away.
SHREK: Oh, come on Dad...an Ogre as King? I don't think that's such a good idea. There's got to be somebody else. Anybody?
KING HAROLD: Aside from you there is only one remaining heir.