How lucky are we that JK Rowling went to the Hogwarts School of Witchcraft and Wizardry or she wouldn't have written... Oh, wait...
Just as well Stephenie Meyer dated that vampire or she wouldn't have written... Oh, wait...
How fortunate that a malevolent spirit possessed Stephen King's car! Without it, he wouldn't have written...
See what I'm getting at? Writing what you know is the state where you've done enough research to make your writing plausible.
Read, Watch, Research
Back in 2014, before I'd even had the idea for my novel Behind the Seams, I read Tailor Made by Josephine Myles. It reminded me of my (disastrous) foray into fashion design and my more successful theatre costume design training. As soon as I finished Josephine's book, I dug out all of my old design textbooks and portfolios, and subscribed to Vogue and Vogue Hommes. I also started (re)watching Project Runway. It was fun, but then the idea for Behind the Seams came to me—'What if a Savile Row tailor attempted to win a fashion design reality TV show?'
Cue me watching a lot of behind-the-scenes documentaries about Savile Row tailors. I'm not a fashion designer, and I'm not a tailor, but I did enough research to feel comfortable writing about both subjects. And then there was all the research into how Project Runway is made...
In short, in order to get ideas, then 'write what you know', you have to question, read, watch, and research.
And when it comes to writing genre, that which you have at your bedside, on your bookshelves, what you reach for, is what you should write. You know the flow, the rhythms, the style and the tropes. If you read a lot of Proust, you're going to have a hard time writing Mills & Boon.
Observe and Record
If you make notes of the normal, everyday happenings with your family and friends, they can spark ideas you can write about creatively. The happenings don't have to be profound, but the way and manner you describe them can inspire ideas that take your stories to another level altogether.
A journal can be invaluable, and a journal can take many forms. Sometimes you can include pictures to describe things you witnessed, articles you've read in newspapers and magazines, or documentaries you've watched.
Naturally, it helps if you're naturally curious (read: nosey). You don't have to cart a notebook around with you—make notes on your phone.
But stories are about people. Harry Potter is about... well... Harry Potter. And we can relate to Harry because he is a person. JK Rowling had a great idea for Harry Potter, but she got to the emotional truth of Harry's story. Harry wasn't just battling the ne'er-do-wells of the magical community, he was battling his way through secondary school. You remember that, right?
While you're thinking about school, have a wander around the other periods in your life that might resonate with the story you're writing. If it's good enough for Ernest Hemingway, it's good enough for you. The Snows of Kilimanjaro is arguably his most autobiographical literary work dealing with issues in his own life such as his relationship to women, war, death, love, sex, nihilism... I could go on.
Know your character. If you've done enough of the right character work, you should be able to stand in their shoes and reflect on what's driving them at any given time. If you're finding that difficult, reflect on what experiences from your past might give you deeper insight.
When you consider the emotions and make decisions accordingly, stories (and characters) come to life.
Pick a person you've encountered but don't know, then create a backstory for them. Imagine their life and what got them to this place and what they believe.
Now, write a few scenes of what decisions they made that got them to this place and what happened to them to form their beliefs.
Sometimes you'll come up with a plot, then populate it with characters, but stories that grow out of characters can, and are often, even more powerful. They resonate with readers.
Keep Asking 'What If?'
When you're writing a story, 'Why?' is the most powerful question you can ask, but 'What if?' is usually the most powerful question to come up with story ideas.
'What if?' can stimulate your creativity, help you avoid clichés, generate multiple ideas, and avoid getting stuck as you continue to expand and plan your ideas and story, respectively.
Once you've got ideas, you can start researching, and research can breed even more ideas for story points (as in, 'What's the point of your story?'), plots, characters, and settings.
There are no limits to 'What if?'.
In conclusion, research, reflection, and observation are key components of writing what you know. By taking the time to engage in these activities, you can create a well-informed and thoughtful piece of writing.