There’s so much talk about particular shapes that “trick” or mislead the zombie pathing… But if you have a pit, and you’re in the pit, then zombies will generally fall into the pit. Because there’s no other way to get closer to you.

I made this base in part to demonstrate that you don’t have to do some things people frequently suggest, like rely on any particular gimmicky shape that causes weird behavior.
https://steamcommunity.com/sharedfiles/filedetails/?id=2858592286

You can take it with a grain of salt, because this was A19 and I’ve moved on to try other designs. But I don’t think the AI for regular zombies has changed in a relevant way since then.

With an open pit all the way around (in other words, a moat), the walking zombies will fall in. Digging wouldn’t be any easier, so they don’t do that. Like Pain Weasel says, what you have for them after they fall in is up to you, but you probably want some sort of base/fighting position in the middle of your pit.