Does your MacBook come with a USB-A port that can support your USB drive directly? If not, check the USB adapter and USB hub your use for building the connection. A faulty USB adapter is likely to cause your WD external hard drive not mounting on Mac.
Newer Mac models are not equipped with traditional USB-A ports. Therefore, you have to use an extra USB adapter or USB hub to connect your WD external hard drive to the Mac. Since you've mentioned the disk is detected by your Mac but the connection is on and off, there's a big chance your adapter is wonky and causes the unstable connection.
To make sure the connection is working well, besides changing to a new adapter, you can do the followings:
Try a different USB port on your Mac. If one port doesn't make your WD external hard drive successfully mount on your Mac, switch to a different one.
Plug in your USB adapter slowly and tightly to avoid a wonky connection. Oftentimes, a loose connection between the storage media and your Mac can result in an external hard drive not working on Mac. Simply remove the disk and re-plug it.
Don't remember to reboot your MacBook after rebuilding the connection. If still, your WD not mounting on Mac after trying out a new USB adapter or USB port, the disk may be damaged or corrupted. You can use fsck command to repair a corrupted hard disk on Mac as you mentioned above. Here's how to do it.
Step 1. Open Terminal from the Launchpad.
Step 2. To view a list of all currently connected drives on your Mac, use the command below and hit Enter.
diskutil list
Step 3. Find your WD external disk and copy its path which looks like /dev/disk2.
Step 4. To boot your Mac in Single User Mode, restart it while holding down the Command and S keys.
Enter the following command:
/sbin/fsck hfs -fy /dev/disk2
Note: replace hfs with the true file system and disk 2 with the actual disk path of your WD.
Step 5. Wait for the diagnosis and repair process. Once done, type in reboot and hit Enter to boot up your Mac.