Consistency is crucial. This may mean taking time off work to be there to take the pup outside every 20-30 minutes when they are awake. Crate training will also help the 'penny drop' as it teaches the pup to hold on until taken outside. Then, be sure to stay with the pup in the yard so you are there to reinforce how clever they are when they do go in the right place.
Understand your puppy's particular breed behavior and needs. Research your dogs breed traits and special needs or any behavior that you should be aware of and look out for. For example, If your puppy is a tiny little chihuahua, their bladder will be very small and they will need to urinate more frequently; accidents will happen even if they are well trained.
The process is the exactly same for older dogs as it is for puppies; prevent accidents from happening by using baby gates and a crate if possible, create a predictable schedule, learn to recognize your dog’s potty signals, accompany your dog outside and immediately reward for all outdoor elimination, properly clean any accidents and supervise your dog until you’re sure that he understands the rules.