Wordfence Security
[resolved] Fatal error: Call to a member function ... + Fix (2 posts)

  1. kraterdesign
    Posted 3 years ago #

    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() ){


  2. Wordfence
    Plugin Author

    Posted 3 years ago #

    Thanks for the awesome bug reports and fixes. We'll get this out in the next few days.

    Kind regards,

    Mark Maunder.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Wordfence Security
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic