Plugins Plugin hub Backup SEO Caching Security Forms WooCommerce Images Best backup plugins
Hosting Hosting directory Shared hosting Managed WordPress Cloud hosting VPS hosting By reader location Hosting finder
Themes & builders Compare Rank Math vs Yoast
Tools All tools Hosting finder Plugin stack builder Cost calculator Salt generator Theme detector Who is hosting this? Speed test Headline analyzer robots.txt generator Redirect generator Uptime calculator Blog name generator
Blog Best backup plugins Deals
Guides All guides Speed up WordPress Choose hosting Back up WordPress
How we test

Security · Guide

How to Remove Wordfence Completely (Without Breaking Your Site)

How to Remove Wordfence Completely (Without Breaking Your Site)

Short answer

To remove Wordfence completely, first enable Delete Wordfence tables and data on deactivation under Wordfence > All Options, and the matching option in Login Security settings. If the firewall is optimized, remove that Extended Protection setup next, then deactivate and delete the plugin. Finally, check that wordfence-waf.php and any auto_prepend_file lines are gone.

Key takeaways

  • Turn on the delete-data options before deactivating Wordfence.
  • Login Security has its own separate delete-data option.
  • Remove firewall optimization first, or the site may show errors.
  • Check for leftover wordfence-waf.php and .user.ini or .htaccess lines.
  • Install a replacement security setup before removing protection.

Why remove Wordfence?

People remove Wordfence when switching to another security plugin or host firewall, fixing high resource use, troubleshooting conflicts, or resetting it to a clean default configuration.

Wordfence is a security plugin with a firewall, malware scanner and login protection. Our explainer on what Wordfence does covers its features.

If the issue is high server load, our guide on Wordfence high CPU usage may solve it without removal.

Conflicts with caching or other security tools are another common reason. Test with the conflicting plugin disabled before removing Wordfence for good.

Decide what will protect the site afterwards. Removing security without a replacement leaves a gap.

Take a full backup before you start. Removal touches files, server settings and the database, so a backup is your safety net if anything goes wrong.

Pick a quiet time, too. If a server setting needs changing, you want a few minutes where errors affect as few visitors as possible.

What does Wordfence leave behind?

Besides the plugin folder, Wordfence can leave database tables, a firewall file named wordfence-waf.php in the site root, auto_prepend_file settings in server files, and a log folder in wp-content.

ItemWhere
Plugin fileswp-content/plugins/wordfence
Database tablesTables with the Wordfence prefix
Firewall loaderwordfence-waf.php in the WordPress root
Server settingauto_prepend_file in .user.ini, .htaccess or php.ini
Firewall logswp-content/wflogs

Wordfence's own guide to removing or resetting Wordfence lists every part and the manual removal steps.

A clean removal handles all of these, not just the plugin.

Leftover tables waste a little database space. A leftover auto_prepend_file line is more serious, because PHP keeps trying to load a file that no longer exists.

How do you set Wordfence to delete its data?

Go to Wordfence > All Options, open General Wordfence Options, tick Delete Wordfence tables and data on deactivation, and save; then do the same under Wordfence > Login Security > Settings.

Without these options, deactivating the plugin leaves its tables in the database.

That is useful if you only want to pause Wordfence briefly. For a permanent removal, the options save manual database work later.

The Login Security option is separate. Missing it leaves some tables behind even after a full uninstall.

If you plan to reinstall later, export your Wordfence settings first so you can import them again.

The export lives in Wordfence's tools section. It saves your options as a token or file you can import on a fresh install.

How do you remove firewall optimization?

If the firewall runs in Extended Protection mode, go to the Firewall options and choose to remove the optimization before deactivating, so the server stops loading the Wordfence firewall file.

Optimization sets the PHP auto_prepend_file value to load wordfence-waf.php before WordPress. Wordfence's guide to optimizing the firewall explains how this works and how to undo it.

Some server setups cache .user.ini files for a few minutes. Wait for the change to apply before deleting the plugin.

After removing optimization, the firewall status should show basic protection rather than extended protection. That confirms the server no longer loads the firewall early.

The PHP manual describes the auto_prepend_file setting that the optimization uses.

What if your host set the firewall path?

On some hosts, support or a control panel setting added the auto_prepend_file value for you; ask them to remove it or remove it from the PHP settings screen yourself.

If you skip this, PHP may look for a missing file and show errors after the plugin is deleted.

Managed hosts sometimes add their own firewall in front of WordPress. Check whether your host already offers one before choosing a replacement.

How do you deactivate and delete Wordfence?

With the delete options enabled and optimization removed, go to Plugins, deactivate Wordfence, then click Delete; WordPress removes the plugin files and Wordfence removes its tables.

Check the site straight away, logged out and logged in.

Open the login page, a normal page and the dashboard. Errors usually show immediately if a firewall setting was missed.

Clear any page or CDN cache. Old cached pages can hide problems for a while, so test fresh pages as well.

If you used two-factor authentication through Wordfence, it stops when the plugin is removed. Set up 2FA with your new security tool.

Tell other administrators before removal, so they are not surprised when the extra login step disappears or changes.

How do you check for leftovers?

Use your host's file manager or SFTP to confirm wordfence-waf.php and the wflogs folder are gone, and check .user.ini, .htaccess and php.ini for Wordfence lines.

The Wordfence section in .htaccess is usually marked with comments. Remove only the lines between those markers.

Look for the user.ini or php.ini files in both the WordPress folder and its parent folder. Some hosts read settings from either location.

Our guide on editing the .htaccess file explains how to edit it safely.

In the database, look for tables with the Wordfence prefix. Back up before deleting any table by hand.

phpMyAdmin or your host's database tool shows table names. Sort by name so the Wordfence tables appear together.

How do you remove Wordfence if you are locked out?

Rename or delete the wordfence folder in wp-content/plugins by SFTP, then remove the auto_prepend_file line and wordfence-waf.php if the site still errors.

Renaming the folder deactivates the plugin immediately.

Once you can log in again, finish the clean removal from the dashboard so the database tables and settings are handled properly.

Our guide on deactivating plugins without admin access covers the same method in detail.

If Wordfence blocked you rather than broke the site, our guide on Wordfence blocking admin may get you back in without removal.

Can you reset Wordfence instead of removing it?

Yes. Enable the delete-data option, deactivate the plugin, then reactivate it; Wordfence recreates its tables with default settings, which often fixes corrupted data.

Remember to turn the delete-data option off afterwards, or the next deactivation will wipe your settings again.

A reset also clears blocked IP lists and scan history. Note anything important before you start.

Our guide to Wordfence settings helps you set it up again from defaults.

What should replace Wordfence?

Choose another security plugin, a host-level firewall or a CDN web application firewall, and keep good basics: updates, strong passwords, two-factor authentication and backups.

Our guide on hardening WordPress on shared hosting covers protections that do not depend on any single plugin.

Keep a short record of which security tool protects the site now. It helps whoever maintains the site next.

Avoid running two full security plugins together. Overlapping firewalls and scanners cause conflicts and slow sites.

A web application firewall filters bad requests before they reach your site. OWASP's overview of web application firewalls explains what they do and their limits.

Whatever you choose, test logins, forms and checkout after enabling it, since firewalls sometimes block legitimate requests.

The official Wordfence plugin page is the place to reinstall it later if you change your mind.

Is it safe to delete Wordfence tables manually?

It is safe once Wordfence is fully removed and you have a backup, but use the built-in delete option where possible because it knows every table.

Table names can change between versions. Check the current list in Wordfence's documentation.

After deleting tables, run a quick check of the site and an optimisation of the database through your host's tools if they offer one.

Only delete tables with the Wordfence prefix. Deleting the wrong table can break your site.

If you are not sure, leave the tables in place. Unused tables are harmless, while deleting the wrong one is not.

Frequently asked questions

How do I completely remove Wordfence?

Enable the delete tables and data options in Wordfence and Login Security settings, remove firewall optimization, then deactivate and delete the plugin and check for leftover files.

Why does my site show an error after deleting Wordfence?

The firewall optimization is probably still loading wordfence-waf.php through auto_prepend_file. Remove that line from .user.ini, .htaccess or php.ini.

Does deleting Wordfence remove its database tables?

Only if you enabled Delete Wordfence tables and data on deactivation, and the matching Login Security option, before deactivating the plugin.

How do I remove Wordfence if I am locked out?

Rename the wordfence folder in wp-content/plugins using SFTP or your file manager, then remove the firewall loader settings if errors remain.

Can I reset Wordfence to default settings?

Yes. Enable the delete-data option, deactivate Wordfence, then reactivate it. Turn the option off again afterwards to protect your new settings.

Sources

  1. Remove or Reset Wordfence Help
  2. Optimizing The Firewall Wordfence Help
  3. auto_prepend_file PHP Manual
  4. Wordfence Security WordPress.org Plugins

Is your product missing, or something out of date?

Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.

About the editors

Written and checked byWPLegible Editorial Team Independent WordPress reviews and guides

Researched from the primary sources listed above and checked against our editorial rules before publishing.