Browse help topics

Security, SSL & Backups

How to Reduce WordPress Login and Comment Spam

Hold new comments for approval, turn comments off where you don't need them, and use a spam-filter plugin. For login attacks, use strong unique passwords, never the username "admin", and two-factor sign-in for every administrator.

  • Updated
  • Last reviewed
  • Beginner
  • About 15 minutes

Applies to: WordPress Blue Arctic Shared Web Hosting (cPanel) and Managed WordPress; WordPress 7.x

On this page
  1. Part 1: Comment spam
  2. Part 2: Login attacks
  3. Part 3: Contact form spam
  4. How to tell it worked
  5. Troubleshooting
  6. Still need help?

You can’t stop bots trying, but a few settings stop them succeeding and keep spam off your pages.

Part 1: Comment spam

  1. Go to Settings → Discussion.
  2. If you don’t want comments at all, uncheck Allow people to submit comments on new posts. This only affects new posts. For older posts, see the next list.
  3. Under Before a comment appears, check Comment must be manually approved. If you’d rather not approve every comment by hand, check Comment author must have a previously approved comment instead.
  4. Under Comment Moderation, set Number of links to allow in a comment before holding for moderation to 1. With 1, any comment that contains a link waits for your approval.
  5. Check Automatically close comments on old posts and set Close comments when post is how many days old, for example 30.
  6. Click Save Changes.

To turn comments off on posts you already published:

  1. Go to Posts → All Posts.
  2. Check the box at the top of the list to select every post on the page. The list normally shows 20 posts at a time, so repeat these steps on each page of it.
  3. Choose Bulk edit from the Bulk actions menu and click Apply.
  4. Set Comments to Do not allow, then click Update.

Then add a spam filter for what’s left:

  1. Go to Plugins → Add Plugin and search for “anti-spam”.
  2. Choose one with many Active Installations and a recent Last Updated date.
  3. Click Install Now, then Activate.
  4. Open the plugin’s settings and finish its setup. Some filters do nothing until you enter a key, and some are free only for personal sites.

Tip

Use the list under Disallowed Comment Keys carefully. Matching comments go straight to the Trash, and words match inside longer words (“press” matches “WordPress”), so genuine comments can be caught.

Part 2: Login attacks

First, make sure no administrator uses the username admin.

Warning

When you delete a user, WordPress asks what to do with their posts and pages. Always choose Attribute all content to another user. If you choose Delete all content, everything that user wrote is deleted.

  1. Go to Users and look at the Username column. If no administrator is called admin, skip to the next list.
  2. Go to Users → Add User. Enter a new Username and an Email address that no other user on this site has.
  3. Copy the password from the Password box into a password manager, or write it down. If the box is empty, click Generate password first.
  4. Set Role to Administrator and click Add User.
  5. Log out, then log in as the new user. Don’t delete admin until this login works.
  6. Go to Users, point to the admin user and click Delete.
  7. If WordPress asks about the user’s content, choose Attribute all content to another user and pick your new user. Click Confirm Deletion.

Afterwards you can give the new user your usual email address. Go to Users → Profile, change Email and click Update Profile. WordPress emails a link to that address, and the change takes effect when you click it.

Then protect every administrator account:

  1. Give every administrator a long, unique password, ideally from a password manager.
  2. Turn on two-factor sign-in (a code from an app on your phone) for every administrator. On Shared Web Hosting, WordPress needs a plugin for this: choose one the same way as the spam filter above. Managed WordPress Hosting includes two-factor protection on WordPress logins, so ask in a support ticket how to use it before you add a plugin.
  3. Save any backup codes the plugin gives you somewhere that isn’t your phone.
  4. Remove administrator rights from anyone who doesn’t need them. Go to Users and click Edit under their name.
  5. Change Role to Editor or Author, which is enough for most writers. Click Update User.
  6. Keep WordPress and plugins updated (see how to update WordPress safely).

Part 3: Contact form spam

Turn on your form plugin’s spam protection. One example is a hidden “honeypot” field (a box people can’t see but bots fill in). Another is a challenge (a quick check people can pass but bots can’t). Also look in the form’s settings for an option to block messages that contain links.

How to tell it worked

Over the next week, new spam comments wait under Pending or Spam on the Comments screen. They don’t appear on your site. Each administrator with two-factor sign-in is asked for a second code when they log in.

Troubleshooting

  • Genuine comments disappear: on the Comments screen, check the Spam and Trash views and click Not Spam or Restore. Then adjust Disallowed Comment Keys or your anti-spam plugin’s settings.
  • You lost your two-factor device: use your backup codes, if you saved any. Otherwise, ask another administrator to turn off two-factor sign-in for your user, or open a support ticket. Resetting your password usually doesn’t turn off two-factor sign-in.
  • Unknown administrators appear: treat the site as hacked. Change your own WordPress password (save the new one before you click Update Profile), then open a support ticket straight away. Include the unknown usernames and when you first saw them. Then follow how to check WordPress for malware and recover.
  • Form notifications stop arriving: see WordPress email not sending.

Still need help?

Open a support ticket from the Client Portal at my.bluearctic.com. Include your site address, what kind of spam you see, which plugins you use for comments, forms and security, and what you already tried. Never include a password.

Was this article helpful?

Report outdated instructions or suggest an improvement
Type of report

Please do not include passwords or personal information.

Still need help?

Our support team can look into your account and walk you through it.