WordPress page in Plesk inaccessible: Call to undefined function add_filter()

Created:

2017-02-19 06:44:55 UTC

Modified:

2017-08-08 13:14:25 UTC

2

Was this article helpful?


Have more questions?

Submit a request

WordPress page in Plesk inaccessible: Call to undefined function add_filter()

Symptoms

  1. WordPress instance at Server Management > WordPress shows as "Broken instance of "domain.name" at /wp-directory"
  2. The following error shows on the administrative WordPress page in Plesk:
PHP Fatal error:  Call to undefined function add_filter() in /usr/local/psa/admin/plib/modules/wp-toolkit/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1017) : eval()'d code on line 86
PHP Stack trace:
PHP  1. {main}() /usr/local/psa/admin/plib/modules/wp-toolkit/vendor/wp-cli/wp-cli/php/boot-fs.php:0
PHP  2. include() /usr/local/psa/admin/plib/modules/wp-toolkit/vendor/wp-cli/wp-cli/php/boot-fs.php:24
PHP  3. WP_CLI\Runner->start() /usr/local/psa/admin/plib/modules/wp-toolkit/vendor/wp-cli/wp-cli/php/wp-cli.php:21
PHP  4. WP_CLI\Runner->load_wordpress() /usr/local/psa/admin/plib/modules/wp-toolkit/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:980
PHP  5. eval() /usr/local/psa/admin/plib/modules/wp-toolkit/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:1017

Cause

Attempt to apply a filter in wp-config.php file.

Actions and filters don't work in wp-config.php, because the functions are not defined yet. It does not affect the website, because the entirety of WordPress is loaded before the filter is defined.

Solution

  1. Check wp-config.php file for string contains similar to the following:

    add_filter()
    
  2. Comment it out or remove.

  3. Synchronize WordPress instance with Plesk Server Management > WordPress > click at "/httpdocs" of broken instance > Refresh. 
Have more questions? Submit a request
Please sign in to leave a comment.