How to Fix the Wordfence White Screen of Death and WAF File Errors
Content
One of the most common and alarming issues reported by users of the Wordfence Security plugin is the sudden appearance of a blank white screen, often accompanied by a fatal error message. This error typically prevents access to both the public-facing website and the WordPress admin dashboard, making it impossible to manage the site normally.
What Causes This Error?
The root cause is almost always related to the Wordfence Web Application Firewall (WAF). For optimal performance, the WAF is "optimized" by loading before the rest of WordPress. This is done by adding a directive to either the .htaccess or .user.ini file that tells the server to automatically prepend the wordfence-waf.php file.
The error occurs when that directive remains in place, but the wordfence-waf.php file it points to is missing. This can happen if you:
- Manually delete the plugin files without first disabling the firewall optimization.
- Accidentally delete the
user.inifile or thewordfence-waf.phpfile itself. - Migrate or restore a website from a backup, and the file paths on the new server are different.
- Perform a cleanup of old plugin files and remove Wordfence remnants without following the proper procedure.
The error message in your server logs will look similar to this:
Warning: Unknown: Failed to open stream: No such file or directory in Unknown on line 0
Fatal error: Failed opening required '/path/to/wordfence-waf.php' in Unknown on line 0
How to Fix It: Remove the WAF Directive
Since you cannot access your WordPress dashboard, the solution requires directly editing your website's files using an FTP client (like FileZilla) or the file manager in your hosting control panel (like cPanel).
- Access Your Site's Root Directory: Connect via FTP/SFTP or your host's file manager and navigate to the root folder of your WordPress installation. This is the same folder that contains your
wp-config.phpfile. - Locate the Configuration File: Look for either an
.htaccessfile or a.user.inifile. Depending on your server's configuration, Wordfence will use one of these. - Edit the File: Download a copy of the file to your computer as a backup. Then, open the file for editing.
- Look for a line that contains
auto_prepend_fileand points towordfence-waf.php. It will look like one of these examples:# Wordfence WAF php_value auto_prepend_file '/home/username/public_html/wordfence-waf.php' # END Wordfence WAF; Wordfence WAF auto_prepend_file = '/home/username/public_html/wordfence-waf.php' ; END Wordfence WAF - Delete only the lines related to Wordfence. Be careful not to remove any other important rules, especially in the
.htaccessfile.
- Look for a line that contains
- Save and Upload: Save the changes to the file and upload it back to your server, overwriting the old one.
- Check Your Site: Refresh your website. The white screen should be gone, and you should be able to access your WordPress admin area again. The Wordfence firewall will have reverted to "Basic Protection," which is better than no site access.
What to Do Next
Once you regain access to your dashboard, you have a few options:
- Reinstall Wordfence: If you want to use Wordfence again, simply reinstall it from the Plugins page. It will guide you through re-optimizing the WAF.
- Complete Uninstallation: If you wish to remove Wordfence completely, first use the official uninstallation procedure within the plugin. Navigate to Wordfence > Tools > Import/Export Options and select the option to "Delete Wordfence tables and data on deactivation." Then deactivate and delete the plugin. This is the best way to ensure a clean removal and prevent this error from happening again.
Important Notes
- If you cannot find the directive in
.htaccessor.user.ini, check for aphp.inifile, though this is less common. - Simply renaming or disabling the plugin folder from your
wp-content/pluginsdirectory will not fix this error, as the server-level directive in.htaccessor.user.iniis still active. - Always make a full backup of your site before editing critical files like
.htaccess.
Related Support Threads Support
-
Wordfence still active even while deletedhttps://wordpress.org/support/topic/wordfence-still-active-even-while-deleted/
-
Site has suspicious file in all directories .listinghttps://wordpress.org/support/topic/site-has-suspicious-file-in-all-directories-listing/
-
trying to restore website sending wordfence messageshttps://wordpress.org/support/topic/trying-to-restore-website-sending-wordfence-messages/
-
I can’t remove extended protectionhttps://wordpress.org/support/topic/i-cant-remove-extended-protection/
-
how to restore wflogs fileshttps://wordpress.org/support/topic/how-to-restore-wflogs-files/
-
URGENT – crashed site by deleting wordfence-waf.phphttps://wordpress.org/support/topic/urgent-crashed-site-by-deleting-wordfence-waf-php/
-
22 database tables not removed after uninstallhttps://wordpress.org/support/topic/22-database-tables-not-removed-after-uninstall/
-
Errorhttps://wordpress.org/support/topic/error-1916/
-
wp_wfhits crashedhttps://wordpress.org/support/topic/wp_wfhits-crashed/
-
Fatal Error: Unknown Failed To Open – How to fix the Wohttps://wordpress.org/support/topic/fatal-error-unknown-failed-to-open-how-to-fix-the-wo/
-
re: uninstallation – website breakshttps://wordpress.org/support/topic/re-uninstallation-website-breaks/
-
Locked Out from Websitehttps://wordpress.org/support/topic/locked-out-from-website-3/
-
Segnalazione da Wordfencehttps://wordpress.org/support/topic/segnalazione-da-wordfence-2/
-
Files in the plugging folder that are extra added and don`t exist in the reposithttps://wordpress.org/support/topic/files-in-the-plugging-folder-that-are-extra-added-and-dont-exist-in-the-reposit/
-
GeoLite2-Country.mmdb of 6GBhttps://wordpress.org/support/topic/geolite2-country-mmdb-of-6gb/
-
Safely addressing the deletable fileshttps://wordpress.org/support/topic/safely-addressing-the-deletable-files/
-
Broken Link on Mobile after Uninstalling – Help!https://wordpress.org/support/topic/broken-link-on-mobile-after-uninstalling-help/
-
SQL query please: Deactivation, Delete, Enable… errors… need to clean DBhttps://wordpress.org/support/topic/sql-query-please-deactivation-delete-enable-errors-need-to-clean-db/
-
wp_wfls_role_counts Errorhttps://wordpress.org/support/topic/wp_wfls_role_counts-error/
-
Wordfence linkhttps://wordpress.org/support/topic/wordfence-link/
-
dup-installer foldershttps://wordpress.org/support/topic/dup-installer-folders/
-
Wordfence Error: Website showing white page even after disabling wordfence.https://wordpress.org/support/topic/wordfence-error-website-showing-white-page-even-after-disabling-wordfence/
-
Current community version of Rules.php filehttps://wordpress.org/support/topic/current-community-version-of-rules-php-file/
-
If I removed Wordfence more than 5 years ago, can I delete the leftover files?https://wordpress.org/support/topic/if-i-removed-wordfence-more-than-5-years-ago-can-i-delete-the-leftover-files/
-
HTACCESS help cant reach Wordfence servershttps://wordpress.org/support/topic/htaccess-help-cant-reach-wordfence-servers/
-
Cannot Modify header information or delete pluginhttps://wordpress.org/support/topic/cannot-modify-header-information-or-delete-plugin/
-
Re-Installing failshttps://wordpress.org/support/topic/re-installing-fails/
-
Getting an warning of a file that doesn’t exist on my serverhttps://wordpress.org/support/topic/getting-an-warning-of-a-file-that-doesnt-exist-on-my-server/