The OP doesn't want to magically hide or show frames at random. He wants to hide them when he enters combat, and frames are not yet protected when PLAYER_REGEN_DISABLED fires, which is what I originally suggested he use......
I did read. Read the first post again:
"Hi, I was wondering how I should hide (and show) my custom made unit frames, specifically the party frames, while being in combat?"
Hiding on entering/leaving combat is not "while in combat".
The code he posted is using Blizzard's secure templates. He's just creating the units individually instead of using a header, which for party frames (not raid frames) is totally fine. But, for the reasons I already detailed, it means that if you want to hide them under certain conditions (eg. while in combat) you can't just hide the frames -- you have to parent them to something that isn't a unit frame, and hide that.
How would that help at all? When a secure frame is parented to FrameX, FrameX becomes implicitly protected and :Hide() calls will not work on it in combat either.
The only reason why Alt+Z works in combat is because secure code is calling UIParent:Hide().