Check IGN or YouTube. Those are the two reliable sources for this one: IGN's game page carries a cheats and secrets section for LEGO titles, and a video walkthrough is often more useful anyway, since a lot of LEGO game "cheats" are really just hidden collectible locations that are easier to see than to describe.
The LEGO games share a common structure that makes this easier. Free Play mode, character-specific abilities, and a hub area mean most secrets are gated behind a character you have not unlocked yet rather than a code. So if you are stuck at a particular spot, the answer is usually to return later with the right character.
Be cautious with generic "cheat code" sites for any game. For LEGO titles in particular, almost nothing is unlocked by typing a code, and pages claiming otherwise are usually ad farms.