When you create a gallery page, WordPress automatically creates a separate page for each image. If you’re using the lightbox plugin you do not see this page but that doesn’t mean it’s not accessible.
A trick by spammers is to use this page to add comment spam because, if comments are enabled by default (which is usually the case with WordPress installations), then comments will be available on these gallery posts and there is no way to turn them off.
To avoid having comments in these media posts it is recommended to have comments disabled on all posts. You can then initialise comments on individual posts on an “as required” basis.
Unfortunately this doesn’t help you if you’re already being spammed in this manner. WordPress forums were not much help as they suggest that you disable comments then delete and rebuild the gallery which, quite frankly, is a poor solution.
If you’re technically minded and not afraid to tackle the database from the back-end then it’s actually very easy to solve this problem.
Firstly you need to know what the galley entry is called. If you’re recieving moderate notification emails the information is already provided
A new comment on the post “Chrysanthemum” is waiting for your approval
Knowing now that the post is called Chrysanthemum we can now log into phpMyAdmin (available from your cPanel if we’re hosting your website), navigate to your WordPress database and open up the wp_posts table to locate the offending post
Click on the edit (pencil) icon and change the comment_status field from “open” to “closed”. Click Go and the change has been made. You can then repeat this process on other offending pages.