Nothing is more annoying that Photos will opens automatically when you connect an iPhone, iPad or other devices to your Mac. Use the following command in Terminal to change this and prevent Photos from opening automatically.

defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true

Revert to the default setting with the following command

defaults -currentHost delete com.apple.ImageCapture disableHotPlug