“Write what you know” – have you ever been told that? Or read it in a book? When people say that I really feel like slapping them. It would be better to say “Know what you write.”
You can have a fantastic idea for a comedy about people working on nuclear reactors. You don’t have to have done it as a job. That’s where research comes in. Learn about what you want to write.
“Give me just enough information so that I can lie convincingly.” ― Stephen King
The only time it’s important to write what you know is internal conflict. Emotions are experienced, not learned. If you want to write a love story, you must have loved. If one of your characters is consumed with hate, you must have experienced hate.
In the writing process you will elevate these emotions beyond your own experience, but you need to have personal experience to draw on.
So, my advice is “Know what you write. Write what you feel.”