How can I stop my dog from barking?
Start by first considering the root of the issue (most commonly boredom, uncertainty in a social setting, confused, overtired) and guiding them towards a better choice that they can potentially make at that moment, and rewarding them for that decision.
When heading towards a scenario where you know they’re likely to bark, first make sure that they’ve had access to outlets for both their physical and mental energy.
During the scenario where your dog is barking, make sure that you’re working in that particular environment with tools that will help you succeed. Such as a leash (a harness), treats to reward good behaviour (such as a any moment where your dog isn't barking), patience, taking distance and above all your listening skills! So that you can pickup on changes in your dog’s non verbal cues, so that you can focus on reinforcing the desired choices your dog makes along the way.
Dogs bark in many different ways and for different reasons, to convey how they're feeling. The most important thing you can do to start helping them is listening for patterns and signs that lead to this behaviour. Chances are you will recognize repeating indicators that will lead to the barking.
This is when it's the best time to practice redirecting, walking away with your doing, showing them that you and they can do something else instead that will feel and be more rewarding than barking.
In many instances the barking stems from dogs not knowing how or what else to do about the trigger (like someone being at the door) which is where you will neec to be extra patient as it takes time for your dog to adopt a new behaviour to replace the old one.
A new behaviour could be waiting for your dog to lay on their bed before opening the door and getting a treat, for example. This requires a lot of practice, will and patience!