How To Stop Comment Spam On Your WordPress Media Attachment Pages

Learn how to prevent spammers posting comments on your WordPress media file attachment pages …

How To Stop Comment Spam On Your WordPress Media Attachment Pages

How To Stop Comment Spam On Your WordPress Media Attachment PagesAre you getting comment spam on your WordPress media attachment pages?

This step-by-step tutorial will show you how to delete comment spam from your media attachments and how to prevent this from happening in the future.

Spammers can be quite devious when it comes to finding new ways to spam your site. Recently, while doing some administration work, I received an automated email notification message from one of my sites that a spam comment had been posted on a media file attachment page …

WordPress comment notification email

(WordPress comment notification email)

My first thought was “How did spammers get to my media files?”

After logging into the site, clicking on the ‘Comments’ menu and verifying that the spam comment had indeed been posted on a media file attachment page, my second thought was … “Oh no! I’ve uploaded a bunch of media files to this site, so I need to shut down hundreds of pages that spammers can target!”

WordPress Comments section

(WordPress Comments section)

I then checked some of the media file attachments pages on the site and saw that the “comments” section was enabled …

Media file attachment page - Comments enabled

(Media file attachment page – Comments enabled)

This was a new site that I had quickly set up and hadn’t finished fully configuring. To prevent further comment spam from being posted on the site through its media attachment pages, I now had to disable the ‘Discussions’ feature for all existing media items.

The tutorial below will show you how to delete comment spam posted to existing media file attachment pages and how to prevent new comment spam from being posted to these pages in the future

How To Delete Comment Spam On Existing Media File Attachment Pages

Useful Tip

Normally, the best way to prevent comment spam is to configure your discussion settings as shown in the tutorial below:

Also, unless certain plugins or features installed on your site require you to upload and use images from the WordPress Media Library, we recommend storing and serving all media used on your website from a media storage and delivery service like Amazon S3.

How To Delete Comment Spam On Existing Media File Attachment Pages Manually

To delete comment spam from existing media file attachment pages, log into your WordPress admin, go to the main menu in your dashboard and select Media > Library …

WordPress Menu: Media > Library

(WordPress Menu: Media > Library)

This brings you to the Media Library screen.

Media Library Grid View

The screenshot below shows items uploaded to your media library displayed as a grid.

To disable comments on media files in the grid view, click on a media element …

WordPress Media Library - Grid Layout

(WordPress Media Library – Grid Layout)

This brings you to the Attachment Details screen.  Click on the ‘View attachment page’ link …

Attachment Details - View attachment page

(Attachment Details – View attachment page)

We need to turn comments off on this page. To do this, click on ‘Edit Media’ in your WordPress admin toolbar

WordPress admin toolbar - Edit Media

(WordPress admin toolbar – Edit Media)

In the Edit Media screen, scroll down to the ‘Discussion’ section and untick the ‘Allow comments’ checkbox to disable comments for that media element’s page …

Edit Media - Discussions

(Edit Media – Discussions)

If you can’t see the Discussion section, scroll to the top of your page and click on the Screen Options tab …

Screen Options tab

(Screen Options tab)

Make sure that the ‘Discussion’ checkbox is enabled in the ‘Boxes’ section …

Screen Options - Boxes > Discussion

(Screen Options – Boxes > Discussion)

After disabling the ‘Allow comments’ checkbox, click Update to save your new settings …

Comments disabled. Update to save your settings

(Comments disabled. Update to save your settings)

Make sure that your media file has been updated. Comments are now disabled for your media attachment page.

Media file updated

(Media file updated)

Useful Tip

Note: If you have sharing features enabled for your media files through a plugin, you may also want to consider disabling sharing options on you media attachments pages (unless you need to leave these turned on) …

Consider disabling sharing features on media attachment pages

(Consider disabling sharing features on media attachment pages)

If using a plugin like Jetpack, for example, you can configure your sharing options to make sure that buttons don’t appear in places where they are not useful or required …

Jetpack Sharing Options

(Jetpack Sharing Options)

Media Library List View

A quicker way to edit your media files attachment pages is to display your media library in ‘List’ view. This way, you can go to the Edit Media screen directly by clicking on the ‘Edit’ link in the Quick Edit menu …

Media Library - Quick Edit > Edit

(Media Library – Quick Edit > Edit)

In the Edit Media screen, disable the ‘Allow comments’ checkbox in the Discussion section to disable comments, then resave the page to update your settings …

Edit Media screen - Disable comments in Discussion section

(Edit Media screen – Disable comments in Discussion section)

What If You Have Too Many Media Elements In Your Media Library … ?

If you have too many media elements uploaded to the WordPress Media Library, then disabling comments for each item manually can become a long and painful task …

What if you have too many media elements to update manually?

(What if you have too many media elements to update manually?)

In this case, we recommend using a plugin.

There are a number of plugins available for WordPress that allow you to disable comments on your site. Let’s take a look at one of these …

Disable Comments

WordPress plugin - Disable Comments

(WordPress plugin – Disable Comments)

Disable Comments is a free WordPress plugin that allows site administrators to disable comments globally on any post type (posts, pages, media attachments, etc.)

It also removes all comment-related fields from edit and quick-edit screens, the WordPress Dashboard, Widgets, the Admin Menu, and the Admin Bar. On multisite installations, it can be used to disable comments on your entire network.

Note: Don’t use this plugin if you want to selectively disable comments on individual posts. This plugin should be used if you don’t want comments at all on your site (or on certain post types), as the plugin settings cannot be overridden for individual posts.

To install the plugin, go to Plugins > Add Plugins and type in “disable comments” in the ‘Keyword’ field …

Plugins > Add Plugins

(Plugins > Add Plugins)

To use the ‘Disable Comments’ plugin, locate the item and click on the ‘Install Now’ button …

Add Plugins > Install Now

(Add Plugins > Install Now)

Click on ‘Activate’ …

Add Plugins > Activate

(Add Plugins > Activate)

After the plugin has been installed and activated, visit the configuration page to configure the plugin’s settings …

Plugin activated

(Plugin activated)

You can also access the plugin settings screen by going to Settings > Disable Comments.

Select the option that best suits your needs (e.g. disable comments throughout your site or only on selected post types – in this case ‘Media’) and click ‘Save Changes’ to update your settings …

Disable Comments screen

(Disable Comments screen)

After configuring and saving your settings, it’s time to check that everything is working as it should.

Go back to your Media Library section by selecting Media > Library from the main menu …

WordPress Menu - Media > Library

(WordPress Menu – Media > Library)

Select a media element that has not been updated yet, and right-click on ‘Edit’ to open the attachment page in a new browser tab …

Media Library - Edit

(Media Library – Edit)

The ‘Discussion’ and ‘Comments’ features should be disabled on the page …

Discussion feature disabled in media attachment page

(Discussion feature disabled in media attachment page)

These features should also have been disabled in the Screen Options tab …

Discussion feature disabled in Screen Options tab

(Discussion feature disabled in Screen Options tab)

And if you visit the media attachment page itself, you should not see the Comments field displayed (No Comments field = No Comment Spam!)

No Comments field = No Comment Spam!

(No Comment!)

Hopefully, this tutorial has helped you with stopping or preventing comment spam from being posted on your WordPress media attachment pages.

How To Stop Comment Spam On Your WordPress Media Attachment Pages

WordPress Content Management

Learn how to manage and delete unwanted content in WordPress like comment spam, plugins, posts and page revisions, fix broken links, and more!

WordPress Content ManagementThis tutorial was created using an earlier version of WordPress and may contain outdated information. Please bookmark this page as we will be updating this tutorial soon! To be notified of updates to our content, subscribe to our updates list (see sidebar), or Like our Facebook page.

***

WordPress Content Management

This tutorial is part of our WordPress Management tutorial series. In this tutorial, you will learn how to delete unwanted content (like comment SPAM) and unnecessary data from your site before performing your file backups and installation upgrades.

Depending on the way your WordPress site has been configured, you may find that comment spam is regularly being posted to your posts or pages. Even with anti-spam filters installed, it’s hard to stop spam altogether. You may also find that there are inactive plugins or old posts or pages with obsolete information that you don’t need on your site anymore.

Every time you perform regular maintenance of your WordPress site, it’s a good idea to go through and delete all comment spam and get rid of unnecessary data from your site before you back up your database. Deleting these from your site before backing up your MySQL database not only helps to reduce your backup file size but more importantly, if you have to restore your data, you won’t be reimporting things like spam and unnecessary things into your site.

Deleting SPAM & Unwanted Data – Step By Step Tutorial

Preventative Measures

One of the best ways to reduce unnecessary data like comment SPAM from your WordPress site is to install plugins like Akismet that effectively prevent many of the more common Spam methods from getting through to your site in the first place.

To learn more about installing and using plugins like Akismet to help prevent comment spam, see the tutorial below:

Deleting Comment Spam

Log into your WordPress site administration area and go to your dashboard section. The summary section of your dashboard shows if there is any comment spam on your site.

To delete spam, either click on “Spam” in the summary view box of your dashboard …

WordPress Content Management

Or click on “Comments” in your site’s admin navigation menu …

WordPress Content Management

You will be taken to the Comments section …

WordPress Content Management

You have a number of options to delete Spam in the comments section:

1 – To let WordPress decide what is and isn’t spam, click on “Empty Spam” …

WordPress Content Management

This will delete all entries in the Comments > Spam section …

WordPress Content Management

2 – If you want to delete most, but not all of the entries in this section, first select all entries, then uncheck any individual items that you do not want to delete.

To manually select and delete all entries, click the checkbox next to “Author” in the column heading, then select “Move To Trash” from the drop down menu and click on “Apply”.

WordPress Content Management

3 – To manually select and delete individual entries, click the checkbox next to the entry or entries you would like deleted. Select Move To Trash from the drop-down menu and click on “Apply”.

If you have moved any entries to the Trash, you will have the option to either restore your entries to the “Comments” section or delete them permanently …

WordPress Content Management

Deleting Plugins

To delete or remove a plugin from your site, make sure that the plugin is inactive (deactivated).

Go to the plugins section of your site by clicking on the Plugins section of your WordPress administration menu …

WordPress Content Management

Find the plugin you want to remove from your site and make sure it’s deactivated …

WordPress Content Management

You now a number of options for deleting the unwanted plugin from your site:

Deleting Plugins Inside WordPress

If your hosting/server configuration allows you to delete WordPress plugins directly from within your WordPress administration area, then simply click on the Delete link below the plugin name in the “Plugins” section …

WordPress Content Management

If you cannot delete a plugin from inside your WordPress admin area, then delete the plugin using either the FTP or cPanel procedures as shown below:

Deleting Plugins Using FTP

To delete an inactive plugin from your WordPress site using FTP (File Transfer Protocol), launch your FTP application …

WordPress Content Management

(image above shows FireFTP add-on for Firefox browser)

Navigate to the “plugins” folder in your server (located inside the “wp-content” folder), and locate the plugin you want to delete …

WordPress Content Management

Delete the plugin from the server (in the example shown below, this was done by right-clicking with the mouse on the plugin folder and selecting “Delete” from the menu – this may work differently for you depending on your FTP application) …

WordPress Content Management

The plugin will be removed from your site.

Deleting Plugins Using cPanel

To delete an inactive plugin from your WordPress site using cPanel, log into your cPanel account …

WordPress Content Management

Double-click on the “File Manager” folder inside your cPanel administration to open it …

WordPress Content Management

Navigate to the “plugins” folder in your server (located inside the “wp-content” folder) and locate the plugin you want to delete. Click once on the filename to select it …

WordPress Content Management

Delete the plugin from the server by clicking on the “Delete” button, then clicking the Delete File(s) button when a confirmation pop-up window appears …

WordPress Content Management

The plugin will be removed from your site.

To learn more about deleting plugins, see the tutorial below:

Deleting Posts And Pages

Deleting posts and pages that you no longer want or need is a straightforward operation.

To delete a post, log into your WordPress administration area and click on Posts in the main navigation menu …

WordPress Content Management

Select the post you want to delete and click on the Trash button to delete the item …

WordPress Content Management

Repeat this process to delete any other unwanted posts from your site.

To delete a page, log into your WordPress administration area and click on Pages in the main navigation menu …

WordPress Content Management

Select the page you want to delete and click on the Trash button to delete the item …

WordPress Content Management

Repeat this process to delete any other unwanted pages from your site.

To learn more about deleting unwanted posts and pages, see the tutorials below:

Managing Your WordPress Content – Additional Steps

As well as performing the maintenance tasks listed above, there are some additional steps you can take to eliminate unwanted or unnecessary content from your site:

Clean Up Your WordPress Installation

If you didn’t perform this step during the WordPress Configuration stage, then do it now.

To learn how to clean up your WordPress installation, see the tutorial below:

Check For Dead Links

Over time, some links on your posts or pages pointing to external sites, pages, and/or resources may become obsolete. This can happen for a number of reasons, e.g. site owners move or delete their pages, terminate their sites, change domain names, etc.

As you have no control over this, it’s a good idea to check for dead or broken links on your site every few months or so. You can also automate this process using plugins.

To learn more about finding and fixing broken links, see the tutorial below:

Delete Post Revisions

WordPress automatically saves your post revisions every time you add a new post or page or edit an existing one. After a while, this can add a lot of unnecessary data to your site. Depending on how often you add content to your site, deleting excess post revisions can help to remove unwanted data and reduce the size of your WordPress database.

To learn more about deleting excess post revisions, see the tutorial below:

Clean Up Your WordPress Database

All data from your WordPress site is stored in a database on your server. Over time, the continuous process of adding, editing, and deleting data, installing and removing plugins, themes, images, etc. to your WordPress database can affect its performance. Cleaning up, backing up, and maintaining your database optimized can help to improve the performance of your website.

Cleaning up your WordPress database and making WordPress database backups is covered in detail in the next section of this tutorial module.

Next Step:

Now that you know how to keep your site free from spam and other unwanted data from your site, the next step is to learn how to clean up your database and perform MySQL data backups.

To learn how to perform MySQL data backups, see the tutorial below:

WordPress Content Management

(Source: Pixabay)

***

"Learning WordPress has been a huge stumbling block for me. I've been looking for something that covers absolutely everything but doesn't cost an arm and a leg. Thank you so much ... you have just provided me with what I have been looking for! Truly appreciated!" - Tanya

***