Barking dogs can be very frustrating. So how do you fix a barking dog? Unfortunately, it does depend. The way to solve a barking dog issue is to figure out why they are barking as the first step and then do the opposite of what the dog wants.
Dogs are extremely smart, but they do think differently then humans. They have different ideas and sometimes think barking is going to get them what they want. For example, if you have a dog that barks when they are in their kennel you can not reward them in any way. If you yell at them for their barking, often the dog will think barking is wonderful because they got attention. It does not matter that your yelling at them- they are still getting your attention which is what they want. If you let your dog out when they were barking, you are teaching them that barking gets them what you want. It will get harder and harder to get your dog to stay quietly in their crate. They will continue to bark, thinking if they bark at you enough, you will eventually get frustrated and let them out. The only way to break them of the habit is often to focus on rewarding them when they are quiet and ignoring them when they bark. Whatever you do, try not reward the barking by opening the crate door.
My girl Indy went through a bad barking phase recently. I was traveling and when I came back, every meal time she started barking. It got old fast. What I ended up doing is walking away from her. She wanted me to pay attention to her and feed her right then. Once I learned what she wanted, I did the opposite. If she barked at me, I left the room. Then I'd try again a little later. It didn't take all that long before she learned I was going to walk away and not give her attention and not feed her while she was barking. If she wanted to eat, she had to be quiet. If you are faced with a similar issue with a barking dog try to think of what it is the dog wants and do the opposite.