Many of spammers target to media attachments on your WordPress website for comments. You can disable comments on your media attachments by using WordPress plugin or adding custom PHP code in your theme file. Below is the two methods described to disable comments on media attachments.
Method 1 – Using Plugin
Disable Comments WordPress plugin provides and option to disable comments globally on your WordPress website. This plugin allows you to disable all type of comments like post comments, pages comments, and media comments.
Method 2 – Using PHP Code
If you don’t want to use any plugin, You can disable media comments by adding custom code in your WordPress theme. Edit functions.php in your WordPress theme file and append following code. This will disable comments on your media posts.
Also remember to create and activate a child theme before doing this so any updates to the theme will not wipe out your hard work.