WordPress E-commerce Security: Protecting Keys, Logins and Checkout
Key takeaways
- Secret API keys belong on the server, never in page code, public repositories or chat messages.
- Most attacks rely on weak passwords or out-of-date plugins. Fix those first.
- Two-factor sign-in for admin accounts is one of the best-value protections.
- Keep backups away from your website server and test that you can restore them.
- Decide now what you will do on the day something goes wrong.
The three threats in plain terms
| Threat | What it means | Common cause | Main defence |
|---|---|---|---|
| API key leak | Someone gets the secret key that lets software talk to your payment or email service | A secret key pasted into page code, a public code repository or a shared chat | Keep secret keys on the server and replace them if they are ever exposed |
| Cross-site scripting (XSS) | An attacker gets harmful code to run in your visitors’ browsers | Unsafe handling of text entered into forms, or a vulnerable plugin or theme | Keep software updated, remove unused plugins and use well-maintained ones |
| Brute-force attack | Software tries thousands of passwords until one works | Weak or reused passwords and no limit on login attempts | Strong passwords, login limits and two-factor sign-in |
Protecting API keys
Payment providers give you a public key and a secret key. The public key is designed to appear in page code. The secret key is not.
- Store secret keys in server settings, not in pages, widgets, theme files or custom code snippets that visitors can see.
- Never paste live secret keys into emails, chat messages or screenshots.
- Use test keys on test sites and live keys only on the live store.
- Give each key the least access it needs, where the provider allows it.
- If a secret key may have been exposed, replace it in the provider’s dashboard straight away.
- Verify webhook messages from your payment provider using the method in its documentation.
Reducing the risk of XSS
XSS is mostly a software problem. Store owners cannot fix code themselves, but can reduce the risk.
- Update WordPress, your theme and every plugin promptly, especially security updates.
- Delete plugins and themes you do not use, instead of just switching them off.
- Choose plugins that are actively maintained and widely used.
- Give staff the lowest user role they need. A shop assistant rarely needs administrator access.
- If you commission custom code, ask the developer how input is cleaned and how output is escaped.
Stopping brute-force attacks
- Use long, unique passwords for every admin account. A password manager makes this easier.
- Turn on two-factor sign-in for administrators and shop managers.
- Limit failed login attempts and block repeated offenders.
- Remove old accounts, such as former staff and previous developers.
- Disable features you do not use. Ask your developer whether XML-RPC is needed.
I recommend starting with two-factor sign-in on admin accounts. It costs little and stops many password-guessing attacks.
Updates, plugins and hosting
Outdated software is one of the most common ways stores are compromised. Updating a store carries some risk, because an update can break checkout. Test important updates on a copy of the site where you can, and check the checkout afterwards.
Good hosting helps too. Choose a provider that supports current PHP versions, separates accounts from each other and offers malware scanning or a firewall. Ask before you buy.
Backups and recovery
A backup is only useful if you can restore it. Keep copies away from the web server, such as in cloud storage, and run a test restore from time to time.
How often to back up depends on how often your store changes. A store that takes orders every day needs more frequent backups than a brochure site.
Making checkout safer
- Use a hosted payment page or a trusted gateway plugin, so card details are handled by the payment provider and not stored on your site.
- Serve the whole site over HTTPS.
- Never store full card numbers, expiry dates or security codes yourself.
- Confirm payments from the provider’s verified notification, not just from the customer’s browser returning to your site.
- Review orders that look unusual, such as many small payments from one visitor.
A simple security checklist
| Task | Suggested timing |
|---|---|
| Apply security updates to WordPress, plugins and themes | As soon as they appear, and a full review weekly |
| Review admin and shop manager accounts | Monthly |
| Run a malware scan | Weekly |
| Test restoring a backup | Every three months |
| Review installed plugins and remove unused ones | Every three months |
| Replace keys and passwords after a staff change | Straight away |
If your store is hacked
- Put the store into maintenance mode or take it offline to protect customers.
- Change all passwords and replace payment and email keys.
- Restore a clean backup, then update everything.
- Scan for malware and look for the cause, such as an outdated plugin or a weak password.
- Check whether customer data may have been exposed. Nigeria’s data protection law may require you to report certain breaches, so get advice if personal data is involved.
- Tell customers honestly if their information is affected.
Doing it yourself or using a managed service
The basics above are within reach of many store owners. The harder part is doing them consistently, week after week.
If you do not have the time, a maintenance service can take over updates, backups and monitoring. No provider can guarantee that a site will never be attacked, so ask what is covered and how recovery works.
How Naija Free Websites approaches this
Our services page describes maintenance that covers updates, fixes, backups and security. By plan, our Starter plan lists basic maintenance and monthly backups. Our Growth plan lists website security and weekly backups. Our Pro plan lists enhanced website security, automated backups and dedicated technical support.
We do not promise that any site will be immune to attack. Security work beyond what a plan lists is quoted separately. Our monthly and ownership plans have no upfront development fee. See the maintenance page and pricing page for details.
Frequently asked questions
Is a security plugin enough?
No. A security plugin helps with login limits, scanning and firewalls, but it cannot fix weak passwords, outdated software or exposed keys. Treat it as one layer among several.
How often should I update my store?
Apply security updates as soon as they are available, and review all updates at least weekly. For stores that take payments, check the checkout after important updates.
Do hosted payment gateways protect me completely?
They reduce your risk because card details are handled by the provider. You still need to protect your admin accounts, keys, plugins and customer data.
Are backups really necessary?
Yes. Backups let you recover from hacks, mistakes and failed updates. Keep them off your web server and test a restore now and then.
Should I hide my login page?
It can reduce noise from automated bots, but it is not real protection. Strong passwords, login limits and two-factor sign-in matter more.