Knowledgebase

How to Secure Your WordPress Website

WordPress is safe when it is maintained properly, but outdated plugins, weak passwords and forgotten themes are the most common ways websites get hacked. This guide explains how to secure your WordPress website with practical steps: keeping everything updated, using strong passwords and two-factor authentication, limiting login attempts, removing unused plugins and themes, taking backups, setting correct file permissions, disabling file editing, using SSL, and what to do if your site is hacked.

1) Keep WordPress, plugins and themes updated

  1. Go to Dashboard > Updates regularly and install WordPress core, plugin and theme updates.
  2. On the Plugins page you can click Enable auto-updates for trusted plugins.
  3. Take a backup before major updates, and test the site after updating.

Outdated plugins and themes with known security holes are one of the most common causes of hacked WordPress sites, so updates are the single most important step.

2) Use strong passwords and two-factor authentication (2FA)

  • Use a long unique password for every administrator, and store it in a password manager.
  • Do not use admin as a username. Create a new administrator with a different username, log in with it, then delete the old admin user and assign its content to the new user.
  • Enable 2FA using a reputable plugin (for example Two-Factor or the 2FA feature of a security plugin) so a stolen password alone is not enough.
  • Give each person their own account with the lowest role they need (Editor, Author, Shop Manager) instead of sharing one administrator account.

3) Limit login attempts

Bots constantly try to guess passwords on wp-login.php. Install a plugin such as Limit Login Attempts Reloaded, or use the login protection in your security plugin, to block an IP after several failed attempts.

4) Remove unused plugins and themes

  1. Go to Plugins > Installed Plugins, deactivate and Delete any plugin you do not use. A deactivated plugin still has files on the server that can be exploited.
  2. Go to Appearance > Themes and delete unused themes. Keep only your active theme (and its parent theme if you use a child theme), plus one default theme for troubleshooting.
  3. Never install "nulled" (pirated) premium plugins or themes; they very often contain malware.
Tip: Before installing a plugin, check when it was last updated and whether it is compatible with your WordPress version. Abandoned plugins are a security risk.

5) Take regular backups

A recent backup is your safety net if anything goes wrong. Keep copies of both files and database, and store at least one copy outside the server. See how to back up and restore your website.

6) Set correct file permissions

From File Manager in cPanel (right-click > Change Permissions) make sure permissions follow these common values:

ItemRecommended permission
Folders755
Files644
wp-config.php640 or 600

Never set files or folders to 777. If your site stops working after changing wp-config.php to 600, use 640 or 644 and contact support.

7) Disable file editing from the dashboard

By default an administrator can edit theme and plugin code from the dashboard. If an attacker gets into an admin account, this editor lets them inject code. Add this line to wp-config.php above the line /* That's all, stop editing! */:

define( 'DISALLOW_FILE_EDIT', true );

8) Use SSL (HTTPS)

SSL encrypts login details and customer data between the browser and the server. Install a free certificate by following how to get a free SSL certificate (AutoSSL) and make sure your site always opens over https://.

Signs your website may be hacked

  • Visitors are redirected to spam, gambling or fake pages, especially from mobile or Google results.
  • Unknown administrator users appear under Users.
  • Google shows "This site may be hacked" or the browser shows a red warning.
  • Strange files appear in public_html, or your hosting account sends spam emails.

What to do if your website is hacked

  1. Do not panic and do not delete files randomly.
  2. Change your cPanel, WordPress administrator, FTP and database passwords.
  3. Contact EgWeb support immediately through a support ticket so the team can scan the account and help you clean or restore it.
  4. After cleaning, update everything, remove unknown users and plugins, and follow the steps in this guide to prevent it happening again.

If you manage your own VPS or dedicated server, also read how to secure your Linux server.

Frequently asked questions

Do I need a security plugin?

A good security plugin helps with login protection, 2FA and alerts, but it does not replace updates, strong passwords and backups. Install only one security plugin to avoid conflicts.

Is it safe to change the wp-admin login URL?

It can reduce bot traffic, but it is not real protection on its own. Strong passwords, 2FA and limited login attempts matter more.

How often should I update?

Check for updates at least weekly. Security updates should be installed as soon as they are released.

Need help? Open a support ticket or message us on WhatsApp +20 127 113 3655.

  • WordPress security, secure WordPress, 2FA, limit login attempts, file permissions, DISALLOW_FILE_EDIT, hacked WordPress, حماية ووردبريس, تأمين ووردبريس, اختراق الموقع

Was this answer helpful?

0 Users Found This Useful