I've been a storyteller most of my life, and writing for about as long as I've been able to put pencil to paper. And most of that writing has been fantasy or soft science fiction. I was actually a writer for years before I ever really heard the advice "write what you know". And I did what any kid would do when their first finished work was a short play about a unicorn beating a dragon in a fight to the death while a bunch of fairies of various shades debated whether she could do it.
I laughed at it.
Because really, when your writing is that far removed from reality by the time you're seven years old, there's no going back. The very idea of only writing what I knew was so ridiculous, so abhorrent, that I essentially ignored it. I didn't even think twice about the fact that there are people who actually take that advice seriously.
But there are. Which is why, in part, we have so many stories about very bookish, nerdy kids who don't fit in; or if the main character is an adult, characters who are actually writers. Because somehow, people think that we actually do have to write what we know.
I'm not very PG, so let me put this simply: BULLSHIT.
I have Opinions about how to be a good writer, and one of those Opinions is that if you're sticking to your own experiences when writing, you're going to be a very poor writer. (Another opinion, though not an Opinion, is that if you want to make sure a word stands out, you capitalize it. This one's a very controversial opinion.) And while "write what you know" doesn't exactly mean "stick to your experiences," too many writers think it does.
So what is good advice? Let's try the opposite: Know what you write. You can write fantasy, science fiction, historical fiction, mystery, thriller, suspense, chick lit, westerns, literary fiction, or whatever genre catches your fancy. Don't feel limited by what you know. Feel limited, if anything, by what you're willing to learn, what you're willing to put in the research to get right.
Of course, once you have the subject matter down, there's a whole other element to it. What message are you putting out with your writing? Writers like to say their intent washes away a whole host of sins from racism (Save the Pearls) to sexual abuse (Fifty Shades of Grey), and readers will excuse them a lot of the time. But we as writers are helping to shape what cultural ideals will be promoted fifty years from now. So look very closely at your writing and make sure you like the ideals you're putting out.