I am getting

Fatal error: Call to undefined function add_filter() in example.com/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?

3 Answers
3

There is a section that should look like this:

defined( 'ABSPATH' ) || define( 'ABSPATH', __DIR__ . "https://wordpress.stackexchange.com/" );
require_once( ABSPATH . 'wp-settings.php' );

add_filter() is available after that, you are probably using it too early.

Leave a Reply

Your email address will not be published. Required fields are marked *