I am getting
Fatal error: Call to undefined function add_filter() in example/wp-config.php on line 20
after adding
add_filter( 'auto_update_plugin', '__return_true' );
to wp-config.php
My plugins.php file is present and add_filter() is defined inside of it.
I just want to enable automatic updates for core, plugins and thems.
What am I doing wrong?
I am getting
Fatal error: Call to undefined function add_filter() in example/wp-config.php on line 20
after adding
add_filter( 'auto_update_plugin', '__return_true' );
to wp-config.php
My plugins.php file is present and add_filter() is defined inside of it.
I just want to enable automatic updates for core, plugins and thems.
What am I doing wrong?
Share Improve this question asked Apr 21, 2014 at 22:13 SkyHiRiderSkyHiRider 1731 gold badge2 silver badges7 bronze badges3 Answers
Reset to default 4There is a section that should look like this:
defined( 'ABSPATH' ) || define( 'ABSPATH', __DIR__ . '/' );
require_once( ABSPATH . 'wp-settings.php' );
add_filter()
is available after that, you are probably using it too early.
The recommended best practice is to use a mu-plugin
for this. Adding add_filter()
s to wp-config.php
directly can cause all kinds of other problems and conflicts.
I used wp-cli and got this error.
I had in wp-config.php at bottom:
remove_filter('template_redirect','redirect_canonical');
instead i put to top
define('WP_HOME','http://example');
define('WP_SITEURL','http://example');
it solved my problem