Derp first, ask questions later. That seems to be the philosophy of these dogs whose curiosity or general greed has clouded their better judgement. And so they end up stuck, which is bad news for them and hilarious news for their owners and everyone else.
If you're a dog owner and your dog ever gets into a situation like this, and it's not in any way going to result in harm, then the first thing you must do is photograph them. Period.
It's an unwritten law of dog ownership. That way everyone else can enjoy your dog's foolishness and have a laugh. It's for the benefit of the dog as well, it's the only way they'll learn.
Well, that's not strictly true because it's unlikely they'll see the photo and unlikely they'll ever stop trying to stick their heads in things or investigate places they shouldn't. Be it peanut butter jars, chain link fences, or children's swings. Curiosity killed the cat, but for dogs it's just shame and humiliation. And amusement for humans.
But after viewing these photos and having a good laugh you'll be very glad that they did.