People tend to assume that a dog is being spiteful or intentional with marking, but there are less malicious reasons behind these types of behaviours. Peeing on objects around the house is often a sign of anxiety, or even a potential medical condition that is affecting your dog.
Dogs can also manifest anxiety in the form of digestive problems, so while it is easy to blame the food your feeding your dog, one of the worst things you can do to try and improve the problem is switch their food right away.
The important thing to remember is not to lose hope. As your dog starts to get more comfortable at home, and your vet has eliminated any potential health problems, you can work on reinforcing the good habit of doing their business outside with lots of praise.