Please use intelligent humor.
Your audience, no matter the age group, is intelligent, and you should treat them that way. The rise of crass humor (and in a more specific sense, potty humor), especially in children's entertainment, is disheartening and disappointing to me as a writer. One should never doubt or insult one's readers. It's a common courtesy.
Basically, I've been reading since I was three years old (verified by The Mom) and the books I have loved most are the ones that just shut up and tell a story. They don't use fluff. They don't beat around the bush. And best of all, they don't talk down to me. Recently I picked up a novel--I don't even remember the title--and I read a few pages to test it out. Less than a chapter in, and I slapped it shut and threw it aside. By the wording the author used, I just knew he/she thought the reader wouldn't understand the subject matter and was treating me poorly as a result. I wasn't about to waste my time on that. Why bother?
The same goes for inappropriate humor. To me, a fart joke tells me a whole lot about the writer. Clearly, this person could think of nothing else to make an audience laugh. Either they didn't have the brainpower (unlikely) to generate a more intelligent joke, or they were simply too lazy to do so (way more likely). It's inexcusable and angering. I don't want to dedicate two hours of my precious day to something that will make me feel like an idiot for watching. That's why I couldn't get past the first half hour of the Angry Birds movie. Take a lesson from The Lego Movie, Angry Birds people. They did it way better than you.
But more pertinently, I do not believe writing is about conning a cheap laugh. It's not even about trying to attract the largest audience of middle-school boys, who I suspect only laugh at this stuff because everybody else is. Writing is about communicating an idea or a story, and in a culture that's slowly squashing the beauty and importance of imagination, content like this drives me out of my skull. The last thing I want is for young, creative people to see that this is the stuff that sells and automatically think they must conform. No. Writers don't have to stoop that low. Writers can be intelligent because the audience is intelligent, and if we all treat each other with respect, there is no need to go that route at all.
Overall, if you're a writer, please be smart. Sure, if your character is immature and uses rude humor, that's fine. Rude people do that, and it can make a realistic statement. But if you, the author, start treating your readers as if this is the only way they'll laugh--forget it. There are a million other books that won't do the same, and just like that, you've lost a reader. So put some thought into your work. Let your creativity do the thinking. Your readers will fall in love with it for what it is, and you can take legitimate joy in that fact.