[Plugin: Wordfence Security] Fatal error: Call to a member function … Fix
-
With Wordfence installed/enabled, I got a blank page while trying to use another plugin “Portable phpmyadmin”. When setting WP_DEBUG to true, the following error was reported:
Fatal error: Call to a member function add_query_var() on a non-object in /…/wp-content/plugins/wordfence/lib/wordfenceClass.php on line 1087
This can be resolved in Wordfence v3.0.6 by editing the plugin file ‘wordfence\lib\wordfenceClass.php”. Find “public static function initAction” (line 1085) and add the line below “global $wp”:
public static function initAction(){ global $wp; if (!is_object($wp)) return;
After this, the other plugin started working just fine.
There’s also a notice, which can easily be fixed:
Notice: is_404 was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. (This message was added in version 3.1.) in /…/wp-includes/functions.php on line 2748.
In the same file, find the line that says “if(is_404() ){” (line 892) and change it to:
if(!empty($wfFunc) && is_404() ){
- The topic ‘[Plugin: Wordfence Security] Fatal error: Call to a member function … Fix’ is closed to new replies.