In the Amber Brown books, part of the reason that Amber Brown and her best friend, Justin, are such good friends is their shared sense of humor, including a fondness for this.
Artemis Fowl: any scene involving Mulch Diggums since his method of tunneling invites these sorts of jokes, and his other bodily function as well.
In Derek Robinson's novel of the Battle of Britain, we first learn why Air Commodore Bletchley is nick-named "Baggy". Then his death is described in excruciating detail - he becomes trapped in a portable chemical toilet when the air-raid siren goes. Deciding to cross his fingers and sit it out - well, squat it out - he chooses wrongly and the whole lavatory is seen bowling across the airstrip, propelled by a hail of cannon and machine-gun fire from a strafing German plane.
In The BFG, where the titular Big Friendly Giant explains how he hates human soda, which has rising bubbles, thus causing the drinker to burp. Burping is phenomenally rude to giants, so instead they drink frobscottle, which has bubbles that sink, thus causing the drinker to... well... whizzpopper!
The film takes this and runs with it: near the end BFG is heaving breakfast with the Queen, and as a gesture of politeness, he pours a round of frobscottle for her, her generals, her staff, her dogs... Cue the Oh, Crap! look on everyone's face just before the room erupts in green-tinted explosions.
Found in, of all things, The Bible. Yes, the holy one (but only in certain translations - the original Hebrew is somewhat euphemistic, and of course no one wants to make a poop joke in the middle of one of God's awesome feats). In 1 Kings 18, Elijah goes up against the prophets of Baal to determine whose God is true. When Baal fails to answer, Elijah begins taunting the other prophets, suggesting that perhaps Baal is simply busy, turned aside to do his business on the side of the road, and if they'll just shout a little louder, perhaps he'll answer them (naturally, he doesn't).
Lampshaded in A Brother's Price: Two people talk, in a tasteful and inoffensive way, about the building of indoor privies and the technology involved, as it is relatively new. It is mentioned that one of the participants enjoys the "innocent rudeness" of this conversation.
The Canterbury Tales mixes in several tales of bawdy, scatalogical humor amongst more devout tales, for example with "The Miller's Tale", which involves a gag where a man farts directly into another man's face.
Dav Pilkey's Captain Underpants books have large amounts of it, which is most often evident from their titles alone, although they also balance it with a healthy dose of social satire.
In Charlie and the Great Glass Elevator, in response to the grandparents taking too much Wonka-Vite, the Oompa-Loompas perform a song telling the sad tale of a little girl who foolishly helped herself to the tastiest-looking stuff in her grandma's medicine cabinet which turned out to be chocolate-flavored laxatives... It takes up several pages. There's also a bedwetting joke.
In "The Long Haul", Greg and his pig both have a Potty Emergency which leads to the pig peeing in Manny's potty. This is also conversed when Greg's teachers disapprove of a series of books called Underpants Bandits because they have too much "rude humor".
In the first book, Fregley chases Greg with a booger on his finger.
In "The Third Wheel", Greg mentions that sometimes he has to wait until all of Manny's Imaginary Friend's are done in the bathroom.
The Dinosaur Vs book "Dinosaur vs. the Potty" is full of jokes about Dinosaur needing to pee.
Dirty Bertie is full of this, because the main character has dirty preferences.
Disgusting McGrossface is mostly just a long list of disgusting traits of a creature, from licking mud off his feet to having a mushroom growing on his butt.
The Divine Comedy, particularly in Inferno, has several passages which indulge in discussion of wallowing in feces, staring at one's own gluteus, and the like. Perhaps most famous is the ending line of Canto XXIII, frequently translated as "And he made a trumpet of his ass."
In Doctor Dog, the grandfather farts the roof off the house and in its sequel, the oldest son steps in poo.
Many parts of Everyone Poops are humorous, such as "Which end is the snake's behind?" and "A one-hump camel makes a one-hump poop and a two-hump camel makes a two-hump poop— only kidding."
The kids' book Excuse Me is about a Funny Animal sheep named Martha May who holds in her farts because she "doesn't make rude noises", resulting in her getting so much gas she floats up into the air.
One kids' book called Farley Farts is about a frog who farts a lot.
Father Christmas Needs a Wee is about Santa Claus having a Potty Emergency and its sequel Father Christmas Comes Up Trumps is about him trying not to fart.
This conversation from the Fudge book "Double Fudge".
Fudge: "Richie Potter likes broccoli."
Peter: "We know."
Fudge: "It makes his pee smell funny."
Mrs Hatcher: "Fudge, we don't talk about what we do in the bathroom at mealtimes."
Fudge: "Why not?"
Peter: "Anyway, it's asparagus that makes pee smell funny, not broccoli."
Mr Hatcher: (warning voice) "Peter..."
Fudge: "Broccoli too, I know because he let me smell it."
Mr Hatcher: "That's enough, boys."
Peter: "Fudge's new friend brags about everything."
Fudge: "He even brags about his poops."
Peter: "I'm not surprised."
Fudge: "But Pete, if you saw what he made, you'd understand. It was thiiiiis long." (holds out his hands)
Mrs Hatcher: "That's it!"
In the autobiographical book, Further Adventures of a Grumpy Old Rock Star by Rick Wakeman of Yes fame, he recounts an anecdote from one of his solo tours in which he and his touring band had been incredibly gassy and amused themselves with their constant farting. Their bus driver apparently didn't think it was as funny as they did and kicked them off after a particularly long one by bassist Lee Pomeroy.
Gangsta Granny has the granny's farts as a running joke and the granny and her grandson Ben climbing up a sewer pipe.
In the Sundered Lands novel Fire Over Swallowhaven, the heroes finally find the phoenix they've been searching for and slowly approach it while hearing rumbling noises. When they get close to the giant beast, they discover that the phoenix is sleeping and repeatedly passing gas in the slumber.
The 16th century novel Gargantua has the protagonist discuss one whole chapter what's the best material to wipe one's ass.
Rabelais loved this trope.
The children's book The Giant's Loo Roll is about a large toilet roll belonging to a giant rolling down the hill and people using it. There's also a joke about the townspeople having to pee.
The children's book Good Families Don't is about an anthropomorphised fart who makes the adults go unconscious.
Both used and deconstructed in Mary Roach's Gulp, which discusses the human digestive process from spit to... poo.
I Have to Go is about a boy named Andrew who has to pee in inconvenient moments.
Horrible Histories sometimes made jokes about poop and pee if it was relevant to some gross historical fact.
Horrible Science: In "Shocking Electricity", they joke about making electricity from methane (which is associated with farts) and the narrator says, "By now you're probably bursting to ask a question, although I don't know for sure, you might be bursting for a pee."
Journey to Chaos: According to Kallen, Nunnal Enaz could alter someone's genetic code to make them pee lemon juice and find it hilarious.
At one point, Oscar sits between his father's legs and says, "Pretend I'm the poop and you're pooping me out."
Oscar farts in the bath once and asks, "What's that horrible smell? Maybe it was those bubbles."
Letters Back to Ancient China, since Kao-tai (the narrator/protagonist, a time-travelling mandarin from medieval China) doesn't know how modern German toilets work and didn't want to ask. But it's still done in as good taste as possible.
In London, a much-abused construction worker lures his Jerkass foreman beneath the shaft of a half-built garderobe and then defecates down the shaft. He'd also prepared for this event by eating a huge meal some hours beforehand...
One story is about a boy who has a toilet seat stuck on his head. He also gets manure in his face at one point.
Oh No, Gotta Go! is a series consisting of only two books, about a girl who speaks both Spanish and English needing to pee (in the first book) and poop (in the second book).
In the children's book Peek-a-Boo Poo, a toddler named Alfie poops in random places.
One children's book, entitled Poo Bum, has a baby bunny who can only say the book's title. He becomes verbal but never stops making toilet jokes.
In the kids' book Potty, Poo Poo, Wee Wee, a young dinosaur keeps shouting potty words and refusing to use his potty.
Ramona Quimby: In "Ramona the Pest", Ramona's kindergarten class hear a story about a man digging a basement and want to know how the construction worker went to the bathroom.
Ratburger has several jokes about animal droppings, pee and toilets.
The School for Good and Evil features a scene where Agatha is crowded by haughty princesses who demand to see proof that she belongs in the school for good. Since she doesn't have any, she does the first thing that comes to mind: she farts, thereby causing them to panic and run away. Later on, one of the complaints leveled at her is that she "farted in our face!"
In the picture book Seagull Sid and the Naughty Things His Seagulls Did, the seagulls (save one named Freda) splat the picknickers with poop because they want the beach to themselves. One even poops in a drink.
In The Stormlight Archive, Shallan interrupts Prince Adolin's formulaic story of his battlefield exploits by asking him how he poops in heavy armour. Once his bewilderment subsides, he admits that they're having a pretty interesting first date.
"So yes, I, Adolin Kholin — cousin to the king, heir to the Kholin princedom — have shat myself in my Shardplate. Three times, all on purpose. You are a very strange woman."
In The Top Secret Undercover Notes Of Buttons Mc Ginty, Buttons notes that the cage room on the ship smells like animal dung and when he and Silky hear a strange noise, they think it might be "the ship farting" or someone having a "bad toilet experience".
Treehouse: In one of the books, a setting for the humor level is "pants-wettingly funny".
Uncle John's Bathroom Reader zig-zags this. One page will have a fart joke, the next will have a scientific article on why we pass gas, and the third will have an article about something crazy like a gold-plated toilet.
Turns up sometimes in Welkin Weasels, most notably in the bit where Scirf escapes the tower by climbing down the garderobe (toilet which drains into the lake).
Sylver: But why didn't you call out to us? Scirf: Couldn't. Had my mouth full. :: Sylver chose not to delve any further into this line of enquiry.
In Why Is Snot Green?, pretty obvious due to the title, but suprisingly averted for the majority of the book.
The World of Poo, Young Sam Vimes's favourite book in the Discworld novel Snuff mixes a lot of this with interesting facts about the historic removal of waste and the function of the digestive system. As Old Sam says, the author has an instinct for what makes a six-year-old boy laugh until he's sick.
The in-universe author, Felicity Beedle, appears in Snuff, in which it's mentioned she's also written books about wee wee, snot, nose-picking, pimples, and a boy's (unspecified) "enormous problem".
Toilet humor is far from the most prevalent type of humor in Discworld but it does pop up from time to time even when Young Sam isn't involved. Harry King tends to bring it, as he's a waste-management businessman (Taking the piss since 1961!) Also, in The Wee Free Men, Tiffany's little brother is confused about what "wee" actually means and keeps calling the Feegles "weewee men."