Shrek 5: The Last Tale is the fifth film in the Shrek franchise, and the turning point from the "Classic" Shrek series to the more modern "Dreck Wars" series of Shrek films.
Rumple, who is still trying to get back Shrek goes to the Poion Apple to seek help and from there is led to see the Snow Queen. They both make a deal and the Snow Queen freezes Shreks swamp. Shrek, Donkey and Puss follow the Snow Queen to Far Far Away but on the way Shrek is chased by an angry mob with pitch forks and torches. They try to kill Shrek but they are stopped when Belle (Beauty and the Beast) saves Shrek and drags him away into the forest. She tries to kiss him but Shrek refuses but then she explains she is meant to kiss the beast so he would transform back into a prince and marry her. Then discovering Shrek is not the beast she runs of to find the beast but Shrek takes her along on his journey because she seemed to know the area.
Then a swarm of witches come to capture Shrek but then the beast jumps out from behind the bushes and shoos all the witches away. Then Belle kisses the beast but he turns into a frog, the former beast tells Belle he was cursed by a witch and he would never be a charming prince. She takes the frog along with her and follows Shrek. They all end up in Hamelin, that's infested with rats and peasants dying of the plague. They head to the castle to ask the king for directions but discover Old King Cole who is very ill from the plague. He informs Shrek and the rest that the Pied Piper usually drives the rats out of Hamelin but the Pied Piper is in a terrible mood and won't leave his room.
Shrek, Donkey, Puss, Belle and Frog knock on the Pied Pipers door and find him sitting on his bed. Shrek tries to cheer him up but instead steals his pipe and drives the rats out of Hamelin himself. They leave Hamelin and then are stopped by a steep cliff. Below the cliff is a small desert town. Shrek and the rest jump down the cliff and escape from the merchants trying to sell them goods but Shrek is stopped and fascinated by a lamp but a street boy by the name of Aladdin takes it of him. Shrek chases Aladdin down the streets to retrieve his lamp he purchased. After pursuing Aladdin in a fast paced parkour relay through the desert town market, something strange begins to happen: the world begins to glitch up.
The film appears to end after the screen fades to white, but it is revealed it was just Shrek waking up. He sits up, revealing he is in a post-apocalyptic desert wasteland. Merlin is standing above him. Merlin reveals to Shrek that all his adventures starting from the end of Shrek 2 to his waking up before then was all an illusion created by him. Shrek grabs Merlin by the neck and demands for him to tell him more, but Merlin teleports away.
The film ends on an ambiguous tone as Shrek turns to the sunset over the desert, the screen cutting to black as he roars a mighty ogre roar.