Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

There 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.

share|improve this answer
That's it, thanks! The Automatic Background Updates Wordpress codex entry (codex.wordpress.org/Configuring_Automatic_Background_Updates) should probably be updated with this info, but I have no idea how. –  SkyHiRider Apr 21 '14 at 23:45
@SkyHiRider I made that update. :) You need an account on wordpress.org to edit the wiki pages. –  toscho Apr 22 '14 at 0:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.