I want to build a farm but don't know if the villagers can open the fence doors because I want them to be placed because of zombies
As far as I know, villagers can open / use the following things:
Doors
Fence gate
Printing plates
Trap doors
You can't use:
lever
Buttons
Iron doors with lever / knob
No, you can't.
https://minecraft.fandom.com/de/wiki/Dorfbewohner#Bewegen
I'm not sure. Doors for sure, but I don't think fence gates. I have a villager farm myself and no one ever ran away. They were just locked up.
As far as I know: No, you can't open fence gates, only doors.