It's a very common thing for canines to dig especially for hunting/retriever breeds such as ALL Retriever breeds, Hounds, Beagles, Pointers, Spaniels, Terriers, etc. It's in their DNA to dig. Its their JOB to hunt, find and retrieve to satisfy their pack leader, YOU.
If you don't have a working breed then other reasons play into WHY they are digging. Boredom, Cooling or Warming, the scent of fertilizer, making a den, escaping, storing food or items (hoarding), and the biggest one ATTENTION.
To first solve this dilemma you must observe your dog digging. How, where, when, and what.
HOW is your dog digging? Is it in one place like under the fence or in the middle of the yard? It is in multiple places 5 to 20 inches apart from each hole?
WHERE is your dog digging?
WHEN are they digging?
WHAT are they digging for?
First answer those questions then you can move on to finding a solution to solve it.
The one thing that will always work with ANY breed and size is EXERCISE!!!! Go for a walk!!! And make it a good walk. 30 minutes to 1 hour depending on size/breed. Make the walk a job for them to accomplish. Purchase a doggy back pack and have them carry bottles of water or their treats or snacks. This will give them the feeling of having to complete a job you are asking them to fulfill and they will be highly rewarded.
**Reminder: Every dog and household is different. What may work for others may not necessarily work for you and your dog. If you are having continuous problems, find a local trainer in your area that can help you and your family.**